I tried to make auto ticketing macro using python Selenium, but when it clicks a button, java script in web changes element of page and StaleElementReferenceException just appears when it finds newly generated elements.
How can I fix this exception? I tried to wait until page reloads elements using driver.implicitly_wait(1)
but still it's not working and seems it's not waiting well.
for timing in seatTiming.find_elements(By.TAG_NAME, "li"):
timing.click() # this removes old elements of seatSpace and generates new element
while len(seatSpace.find_elements(By.TAG_NAME, "li")) < 1: # wait until seatSpace gets elements
driver.implicitly_wait(0.1)
for seat in seatSpace.find_elements(By.TAG_NAME, "li"):
currentClass = seat.find_element(By.TAG_NAME, "strong").text # ERROR
print(currentClass)