I'm trying to iterate over a list of web elements and click on every element in the list, but after the first click I'm getting StaleElementReferenceException. As I understand the page refreshes and the id of the elements get "stale". Is there a workaround? Thanks
elements = driver.find_elements_by_css_selector("span.name")
for element in range(len(elements)):
elements[element].click()