Site has top menu with 6 links. I can get list of this links like this:
links = browser.find_elements_by_css_selector(MENU_LINKS_CSS_SELECTOR)
After this I need to click this links one by one. If I do it like this:
for link in links:
link.click()
I get the following error: selenium.common.exceptions.StaleElementReferenceException: Message: u'Element not found in the cache - perhaps the page has changed since it was looked up'. As I understand, this error raises beacause of connection betweeb WebElement instances and DOM of the web-page is broken after reloading the page (clicking on link).
Here I should notice that top menu is the same on all pages.
So, what I do wrong? How to fix this? TIA!