[英]How to get the heading of an alert in selenium webdriver using java?
[英]how to go to another page when clicking on Alert Box in selenium Webdriver by using Java
我打开了我的警报框,然后我想移至购物清单,但无法访问购物清单页面,我的代码是-
driver.findElement(By.xpath("/html/body/div[1]/div[1]/div/div[4]/div[2]/div[2]/div[2]/div[2]/div/div/form/div[3]/button[2]")).click();
Alert alert = driver.switchTo().alert();
alert.accept();
Thread.sleep(2000);
driver.findElement(By.linkText("Shopping List")).click();
它一次又一次地显示相同的错误,我使用了越来越多的代码,但是找不到任何解决方案,请帮助我Tester ...
没有警报存在(警告:服务器未提供任何堆栈跟踪信息)
您将不得不等待警报弹出:
new WebDriverWait(driver, 60)
.ignoring(NoAlertPresentException.class)
.until(ExpectedConditions.alertIsPresent());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.