I got a stale reference exception. How to avoid that?
If the webdriver tries to access a web element that is currently unavailable or invalid in the DOM, the StaleElementReferenceException is thrown. This could be due to a page refresh or an element being mistakenly deleted, updated, or disconnected from the DOM.