Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to click on Subject field in MS Outlook 2016 application. #77

Open
bharadwaj-pendyala opened this issue Mar 29, 2018 · 0 comments

Comments

@bharadwaj-pendyala
Copy link

Trying to automate a new scenario where we open the Outlook application and follow below steps.

  1. Enter to email address.
  2. Enter subject.
  3. Enter email content.

Able to automate till Step 1 and Step 3. Only step 2 is not being identified. PFB the below source code. Tried all possible combinations for subject properties. Tried to find it using name - "Subject" and using class name and also automation id. But no luck. Kind of stuck and need help regarding the same.

Thank You.

package test;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.IOException;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import Allocator.Allocator;

public class MSOutlook extends Allocator {

	public void openOutlook() throws InterruptedException, IOException {
		setupEnvironment("Outlook");
		Thread.sleep(10000);		
	}
	
	public void sampleOps() {
		driver.findElement(By.name("File Tab")).click();
		driver.findElement(By.name("Exit")).click();
	}
	
	public void sendEmail() throws InterruptedException, AWTException {
		driver.findElement(By.name("New Email")).click();
		Thread.sleep(2000);
		WebElement to = driver.findElement(By.name("To"));
		WebElement cc = driver.findElement(By.name("Cc"));
		WebElement sub = driver.findElement(By.className("Static"));
		to.sendKeys("[email protected]");
		sub.sendKeys("Subject");
			
		//Insert Subject
		driver.findElement(By.name("Page 1 content")).sendKeys("Test Email");
		driver.findElement(By.name("Send")).click();
		driver.close();
	}

	public static void main(String args[]) throws InterruptedException, IOException, AWTException {
		MSOutlook c = new MSOutlook();
		c.openOutlook();
		c.sendEmail();
	}

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant