利用selenium webdriver点击alert提示框
生活随笔
收集整理的這篇文章主要介紹了
利用selenium webdriver点击alert提示框
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在進行元素定位時常常遇到這樣的alert框:
那么該如何定位并點擊確定或取消按鈕呢?stackoverflow上找到了這個問題的答案。
?
OK, Show you the code:
1 driver.findElement(By.id("updateButton")).click(); 2 //pop up with id "updateButton" opens 3 Alert alert = driver.switchTo().alert(); 4 //update is executed 5 alert.accept();如果是點取消,則:
alert.dismiss();
?
附幾個相關鏈接:
http://www.cnblogs.com/qiaoyeye/p/5593428.html
http://sanwen8.cn/p/w3dEEE.html
?
轉載于:https://www.cnblogs.com/songshu120/p/6163504.html
總結
以上是生活随笔為你收集整理的利用selenium webdriver点击alert提示框的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python爬虫入门之Urllib库的基
- 下一篇: wampserver 虚拟主机