The issue is that when you click a link, the collection of links in imgLinks
immediately becomes stale. Going back to the page, and trying to interact with the imgLinks
list is going to result in a state element reference error.
This approach should work for you. It will get a new list each time you return to the page.
List<WebElement> imgLinks = this.webDriver.findElements(By.xpath("//img[contains(@src,'exit.png')]"));
int imgLinksLength = imgLinks.size();
for(int i = 0; i < imgLinksLength ; i++) {
List<WebElement> imgLinks = this.webDriver.findElements(By.xpath("//img[contains(@src,'exit.png')]"));
imgLinks.get(i).click();
//some code to return for this html page (back) and click in the next image...
}