I have a code for chrome driver to extract data
I have a code like this:
def click_all_options(path):
try:
for option in browser.find_elements_by_xpath(path):
option.click()
return True
except StaleElementReferenceException:
return False
select1 = '/html/body/form[2]/table/tbody/tr[1]/td[1]/select/option'
select2 = '/html/body/form[2]/table/tbody/tr[1]/td[2]/table/tbody/tr[1]/td[1]/select/option'
result = click_all_options(select1)
if not result:
click_all_options(select2)
The problem is that this doesn't lead to a nested for loop. How can I tweak this to get a nested for loop?