Sep-08-2022, 01:36 AM
Hello everyone, Need your help with the following script the problem I am running into it pages down in a continuous loading page, until it reaches the bottom, however it does not timeout of after a few seconds. The dynamic loading page can contain 4 to over thousands of elements as I was able to put this script together as it did not have any issues scrolling down in this case to the 300 elements in a pop up window. What can I modify in the script so that it stops at the last element at the bottom of the popup window? Thanks
mlst=[] actions1 = ActionChains(browser) while len(WebDriverWait(browser, 0).until(EC.visibility_of_all_elements_located((By.XPATH, "//span[@class='_yua_']")))) > 0: actions1.send_keys(Keys.PAGE_DOWN).perform() time.sleep(10) try: x=WebDriverWait(browser, 5).until(EC.visibility_of_all_elements_located((By.XPATH, "//span[@class='_yua_']"))) mlst.extend(x) print("element found") except TimeoutException as exm: print("Timeout Exception has been thrown. " + str(exm)) break for a in mlst: print(a.text)