差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

下次修改
前次修改
rf:rf:staleelementreferenceexception [2018/01/16 16:20]
tony 建立
rf:rf:staleelementreferenceexception [2023/06/25 09:48] (目前版本)
行 2: 行 2:
 ====== StaleElementReferenceException:​ Message: stale element reference: element is not attached to the page document ====== ====== StaleElementReferenceException:​ Message: stale element reference: element is not attached to the page document ======
 ===== Problem ===== ===== Problem =====
-這陣子把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? =====
 +參考網路上資料,大都說是由於要存取的目標沒出現在網頁上;然而在我們測試報表中,Screenshot是看的到我們所要操作的目標。因此我們推測可能是由於websocket引起的refresh所造成的。面對這個問題,我們採取retry的做法:​
 +<code bash>
 +Get Text
 +    [Arguments] ​   ${locator}
 +    ${text} ​   Wait Until Keyword Succeeds ​   2x    10ms    Selenium2Library.Get Text    ${locator}
 +    [Return] ​   ${text}
 +</​code>​
 +透過Wrapper的方式,把SeleniumLibrary的GetTex包在WrapperLibrary內去達到retry的效果。\\
 +\\
 與其說真的解決,不如說這是個workaround。 與其說真的解決,不如說這是個workaround。
 +\\
 +
 +===== 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]]
 +  * [[http://​www.seleniumhq.org/​exceptions/​stale_element_reference.jsp|Stale Element Reference Exception]]
  
 =====    ===== =====    =====
行 10: 行 24:
 \\ \\
 ~~DISQUS~~ ~~DISQUS~~
-