What version of selenium library do you use?
The exception is very common in selenium tests. And I think it is one of the reasons why people move to browser library, although it also had some timing issues.
A view suggestions:
- adding a sleep before the failing keyword helps, buy it is inpractical for obvious reasons
- setting implicit wait in selenium library might work
better check if you can upgrade to latest version of selenium library As stale elements is the most annoying error, there has been some magic tricks been implemented in later selenium versions
- before those magic tricks, I believe I had success adding seleniumtestability library as plugin for selenium library. But I am not sure if that is still necessary nowadays
There are few tricks like using
Wait until keyword succeeds but they are ugly and also as the error messages appeared at random in my test cases, I cannot verify what actually worked. All I can say, that after some updates, the error messages became rare.