As the topic suggests, I would like to ask what is the way to prevent this exception occur. I have searched in the Appium forum to understand the cause of this, from my understanding it seems it is about the "previously found element no longer exist when we are using it again)
And for the solutions, I found several ways and applied it, but the exception still occur quite often and randomly (just like every element was found could prompt this exception)
The ways I have tried:
- Added ‘waitForIdleTImeout’ = 0 into desired capability
- Added driver.update_settings({“boundElementsByIndex”: “True”})
(The second method is suggested by the error message) - Added driver.update_settings({“snapshotMaxDepth”: 500})
The above ways is the way to prevent it, in fact when I encountered this exception, in python, I just use a “try-catch” to ask it to search those “no longer exist” elements again, or add more time sleep between each finding elements command to try to make it be stable.
Would like to ask still any effective way to eliminate this error? ( In fact when I was developing the automation process for the same app 1 year ago, this “StaleElementReference” never happen,) not sure which part is changed that cause it become a nightmare for me. thanks…