0

So I was encountering a StaleElementReferenceException only when the UI tests run as part of CI, hence it’s almost impossible for me to reproduce locally as compared to when I run on Bamboo. I’ve concluded by seeing this answer and by looking at the timing logs that it’s running much faster in the CI build than when I run it on IntelliJ, so it’s not giving the page enough time to completely load the results. Rather than asking for solutions, since I figured this part out, I’m wondering if this is a valid claim and why it’s performing this way and ways to debug to get to the root of the problem. My local maven build is actually not much faster than the IntelliJ run, but somehow it’s significantly faster on Bamboo.

Any explanations for this, and how I might be able to reproduce the error locally? I’ve been trying to set a breakpoint in Chrome when certain DOM children change, but I can’t pinpoint the time in which the element becomes stale. I have IntelliJ’s debugger running and I’ll look for an element, store it, step through the DOM changes in Chrome, checking each time if it breaks Any suggestions on how I can better debug/reproduce and if I’m on the right track with it being from the CI build running faster?

rb612
  • 5,280
  • 3
  • 30
  • 68

1 Answers1

0

As for the speed, it could simply be that the CI machine is faster than yours.

But that won't help you investigate the root cause of the StaleElementReferenceException. For that, you should investigate the stack trace of the exception together with the code to understand what line causes this exception and why. Add log entries, screenshots and page source as necessary to get more context, and consult the developers for possible reasons for the relevant element to be removed from the DOM (which is what causes StaleElementReferenceException).

If you want to experiment with solutions in order to debug, without committing your changes and running a new build each time, you can login to the build machine and run the tests from its command line to see how it behaves.

Arnon Axelrod
  • 1,444
  • 2
  • 13
  • 21