I'm using chrome driver to extract data.
I'm stuck at one point: I need to iterate over an entire list (all elements). The first time it works, and I'm able to download one file.
For the second iteration, it shows up a mistake of "StaleElementReferenceException with an element is not attached to the page document".
The code looks something like this:
for elem in browser.find_elements_by_xpath('/html/body/form[2]/table/tbody/tr[1]/td[1]/select/option'):
elem.click()
sleep(2)
for ele in browser.find_elements_by_xpath('/html/body/form[2]/table/tbody/tr[1]/td[2]/table/tbody/tr[1]/td[1]/select/option'):
ele.click()
How should I change my loop to get over this problem? (the problem is at ele.click)