I'm using Selenium to download several files. The process is simple: I look for a reference, wait until results are ready and download the associated files.
I've a problem with the part "wait until results are ready". The website uses an AJAX table which loads the results. During the update of this table, an attribute appears in the HTML code and when results are ready it dissapears.
The object is always present, it's only the attribute that changes. If I do the next loop just right after clicking the button of search:
for i in range(0,10):
print(self.driver.find_element(By.ID, "gridpoOverview").get_attribute("aria-busy"))
time.sleep(0.05)
It returns (so I know how to detect it):
none
true
true
none
none
none
none
none
none
none
I want to do it using an EC, but the next code doesn't work (Timeout exception):
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.XPATH, '//div[@id="gridpoOverview" and @aria-busy="true"]')))