• StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  • Problem
  • How to resolve?
  • Reference
  • 參考網路上資料,大都說是由於要存取的目標沒出現在網頁上;然而在我們測試報表中,Screenshot是看的到我們所要操作的目標。因此我們推測可能是由於websocket引起的refresh所造成的。面對這個問題,我們採取retry的做法:

    Get Text
        [Arguments]    ${locator}
        ${text}    Wait Until Keyword Succeeds    2x    10ms    Selenium2Library.Get Text    ${locator}
        [Return]    ${text}
    透過Wrapper的方式,把SeleniumLibrary的GetTex包在WrapperLibrary內去達到retry的效果。
    與其說真的解決,不如說這是個workaround。