power_settings_new

Identifying Gmail compose button in my webdriver script

by
asked
0 like 0 dislike
385 views
0 1

I am not having success trying to identify and click the compose email button in google. Tried various locator techniques like Xpath, Css selector but keep getting the illlegal selector error.

 

Below is my current code for logging in and clicking on the compose button in Gmail,

driver.get("https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/");

    driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);

    driver.findElement(By.id("Email")).sendKeys(email);

    driver.findElement(By.id("Passwd")).sendKeys(Password);

    WebElement stay_signed_in = driver.findElement(By.id("PersistentCookie"));

    //if(stay_signed_in.isSelected())

    //stay_signed_in.click();//

    driver.findElement(By.id("signIn")).click();

    WebDriverWait wait = new WebDriverWait (driver, 15);

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("div[gh='cm']")));

    WebElement compose_button = driver.findElement(By.xpath("div[gh='cm']"));

    compose_button.click();

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by
selected by
0 like 0 dislike
 
Best answer
0

I was able to find to find this using the following Xpath code,

 

     WebElement compose_button = driver.findElement(By.xpath("//div[@gh='cm']"));

Related questions

add
...