
在进行元素定位时常常遇到这样的alert框:
那么该如何定位并点击确定或取消按钮呢?*上找到了这个问题的答案。
OK, Show you the code:
driver.findElement(By.id("updateButton")).click();
//pop up with id "updateButton" opens
Alert alert = driver.switchTo().alert();
//update is executed
alert.accept();
如果是点取消,则:
alert.dismiss();
附几个相关链接:
http://www.cnblogs.com/qiaoyeye/p/5593428.html
http://sanwen8.cn/p/w3dEEE.html