差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
rf:rf:staleelementreferenceexception [2018/01/16 16:28] tony [Problem] |
rf:rf:staleelementreferenceexception [2023/06/25 09:48] (目前版本) |
||
---|---|---|---|
行 4: | 行 4: | ||
這陣子把SeleniumLibrary更新到了3.0後,開始發生測試不穩定的問題;其中一樣就是在呼叫Get Text時,發生StaleElementReferenceException: Message: stale element reference: element is not attached to the page document的問題。 | 這陣子把SeleniumLibrary更新到了3.0後,開始發生測試不穩定的問題;其中一樣就是在呼叫Get Text時,發生StaleElementReferenceException: Message: stale element reference: element is not attached to the page document的問題。 | ||
===== How to resolve? ===== | ===== How to resolve? ===== | ||
- | 與其說真的解決,不如說這是個workaround。 | + | 參考網路上資料,大都說是由於要存取的目標沒出現在網頁上;然而在我們測試報表中,Screenshot是看的到我們所要操作的目標。因此我們推測可能是由於websocket引起的refresh所造成的。面對這個問題,我們採取retry的做法: |
<code bash> | <code bash> | ||
Get Text | Get Text | ||
行 11: | 行 11: | ||
[Return] ${text} | [Return] ${text} | ||
</code> | </code> | ||
+ | 透過Wrapper的方式,把SeleniumLibrary的GetTex包在WrapperLibrary內去達到retry的效果。\\ | ||
+ | \\ | ||
+ | 與其說真的解決,不如說這是個workaround。 | ||
+ | \\ | ||
+ | |||
===== Reference ===== | ===== Reference ===== | ||
* [[https://stackoverflow.com/questions/18225997/stale-element-reference-element-is-not-attached-to-the-page-document|stale element reference: element is not attached to the page document]] | * [[https://stackoverflow.com/questions/18225997/stale-element-reference-element-is-not-attached-to-the-page-document|stale element reference: element is not attached to the page document]] |