The click is impacting the DOM, which is rendering all previous webElements to become stale. So even if the xpath remains the same, the webElement object will become stale:

Find some more information here: www.softwaretestingmaterial.com/stale-element-reference-exception-selenium-webdriver/

A solution would be: loop and save the urls, not the webelements OR Open links in new windows and use switchTo

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top