How to click links one by one with Selenium webdriver and Python -
site has top menu 6 links. can list of links this:
links = browser.find_elements_by_css_selector(menu_links_css_selector)
after need click links 1 one. if this:
for link in links: link.click()
i following error: selenium.common.exceptions.staleelementreferenceexception: message: u'element not found in cache - perhaps page has changed since looked up'
. understand, error raises beacause of connection betweeb webelement
instances , dom of web-page broken after reloading page (clicking on link).
here should notice top menu same on pages.
so, wrong? how fix this? tia!
i don't know selenium should select links again -
for in range(0,6): links = browser.find_elements_by_css_selector(menu_links_css_selector) links[i].click()
Comments
Post a Comment