I want to iterate through each radio button and perform some action. But enable to do so. It says selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document as error. The reason is after saving it reloads the page. How to handle it?
radioButton = (driver.find_elements_by_xpath("//input[@type='radio']"))
print(len(radioButton))
for radio in radioButton:
print(radio.get_attribute("value"))
radio.click()
driver.find_element_by_xpath("//button[@ng-click='handleEdit()']").click()
driver.find_element_by_xpath("//input[@placeholder='Contact Number']").clear()
driver.find_element_by_xpath("//button[@ng-click='handleSave()']").click()
time.sleep(5)