I'm trying to automate a testcase, where in there are around 30 links in a page. All these links will lead to a new page. And depending upon on a value in the new page, I need to either proceed or need to come back to the original page and re-select the link. This needs to be done until I find a particular value in the new page.
So, I got a List of the links, then I started iterating, but as soon as I navigate back, either using driver.navigate().back()
or another option and then try to find & click the next link, it hits StaleElementException
.
Any idea how I can handle this situation? Any help, code or approach wise would be highly appreciated!