stale element reference: element is not attached to the page document 異常


在執行腳本時,有時候引用一些元素對象會拋出如下異常

  org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document

按字面表達的意思大概是,所引用的元素已過時,不再依附於當前頁面。通常情況下,這是因為頁面進行了刷新或跳轉,解決方法是,重新使用 findElement 或 findElements 方法進行元素定位即可。



免責聲明!

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



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