Sep-08-2022, 10:52 PM
(Sep-08-2022, 09:28 PM)giddyhead Wrote:(Sep-08-2022, 04:01 AM)XavierPlatinum Wrote: What about replacing the while loop with a for loop?
Then it will stop when it is finished.
Quote:Got it. Thanks for the information. it worked.
Quote:I have updated the script as follows. Thanks. Have one more question how can I go about counting the number of elements in a class before another class. For example in a popup windows class _yua_ has 20 names and class _gilua_1' shows up between the 5th and 6th name. How can I go about getting the number 5 due to class _guilua_1 is between the 5th and 6th element. Once again. Thanks
actions1 = ActionChains(browser) for cltx in WebDriverWait(browser, 0).until(EC.visibility_of_all_elements_located((By.XPATH, "//span[@class='_yua_']"))): 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_']"))) print("element found") except TimeoutException as ex: #break isrunning = 0 print("Exception has been thrown. " + str(ex)) break print("No such element") else: if WebDriverWait(browser, 5).until(EC.presence_of_element_located((By.XPATH, "//h4[@class='_gilua_1']"))): print('Found the text Looking For') break else: print('Else lets see')