Stale element reference: element is not attached to the page document.

Hi Gabriel

It would be nice to see the lines of code that caused the error.

If you believe that the object should be ready to interact with and sometimes this same test passes, then it is likely one of two things:

1 - The network/server is running slower than usual.

Perhaps you didn’t refresh the object being tested after the page
updated (possibly via ajax?) or you didn’t wait long enough for it to be
loaded/visible or otherwise addressable.

2 - WebDriver is lying to you.

This is a rare occurrence but happens often enough to cause you pain. There is a bug (certainly in the gecko driver) that causes that message to appear when it should not. The cause is a mystery. The cure is to avoid using WebUI.waitFor* and WebUI.click etc and write your own using JavaScript which allows you to deal more directly with the page. (Warning: This is not a trivial undertaking!)

Russ