I'm trying to wait for the innerHTML element to load. Here is the generic version of my code:
element = WebDriverWait(driver, 120).until(EC.presence_of_element_located((By.XPATH, XPATH)))
element = element.get_attribute('innerHTML')
Element is a tr tag inside of a table. This code is inside of a loop that is supposed to run 25x per page over thousands of ajax pages. After a certain amount of runs, I continue to receive this error:
selenium.common.exceptions.StaleElementReferenceException: Message: {"errorMessage":"Element is no longer attached to the DOM"...
Every time, this error stems from the second line of provided code. This leads me to believe the element is loading, but the innerHTML is not loading quickly enough, and this elicits the given error message. I've tried many ways to get around this without success.
How can I make my code wait for the innerHTML to load after the element's presence has been confirmed?
innerHTML
?element
is pointing to and what things change in the inner HTML of the element?..thanks!element
is a cell (tr tag) inside of a table with consistent table headers (th tags). The inner HTML for eachelement
changes 25x per page, whereas the table headers are the same on every page