Binu Binu -4 years ago 115
Java Question

Open mails from Gmail inbox using selenium webdriver using java

I need to open mails from Gmail inbox using selenium webdriver using java in Eclipse IDE. Is there a way to do this using xpath?

Answer Source
//open a mail from the gmail inbox.
List<WebElement> a = driver.findElements(By.xpath("//*[@class='yW']/span"));
            System.out.println(a.size());
            for (int i = 0; i < a.size(); i++) {
                System.out.println(a.get(i).getText());
                if (a.get(i).getText().equals("Support")) //to click on a specific mail.
                    {                                           
                    a.get(i).click();
                }
            }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download