简体   繁体   中英

Not able to click on “Confirm Email” link using selenium webdriver (Java)

I want to click "Confirm Email Address" link from email body.But, can't locate the element of it as it has link references.I have tried using link text & cssSelector but, it still not working.

driver.findElement(By.linkText("Confirm Email Address")).click();
driver.findElement(By.cssSelector("//a[contains(text(),'Confirm')]")).click();

It may be a Wait problem. You need to wait for that element for its visibility. Try the code below.

WebDriverWait wait = new WebDriverWait(driver,30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Confirm Email Address"))).click();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM