selenium - 常見問題(一)元素交互報錯:ElementNotInteractableException


報錯:selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

 是因為頁面元素不可見,如頁面縮小了,將頁面最大化即可。

 建議:可以在每次測試前,將頁面最大化,如下:

driver = webdriver.Chrome()
driver.maximize_window()    # 最大化頁面
driver.get('http://www.baidu.com')

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM