public void test() {
driver.get("https://google.com");
driver.findElement(By.cssSelector("div.gb_Vf a.gb_D")).click(); //clicks google app button
WebDriverWait wait = new WebDriverWait(driver,30);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("(//ul[@jsname='k77Iif']/li/a)[4]")));
WebElement elm = driver.findElement(By.xpath("(//ul[@jsname='k77Iif']/li/a)[4]")); //this locator is uniquely identiying youtube icon
elm.click(); //it should click youtube icon, but code is unable to do this
}
I tried many locators, even though they are uniquely identifying youtube icon manually, but code is not working. Please help me solve it. Thank you.
Aucun commentaire:
Enregistrer un commentaire