bypassing find element click() - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: bypassing find element click() (/thread-25532.html) |
bypassing find element click() - windows11 - Apr-02-2020 Hello guys, I dont know why but sometimes the click() do not work a=11 def my_function(i,driver): while i<a: element=driver.wait.until(EC.presence_of_element_located((By.XPATH,f[i]))) driver.find_element_by_xpath(f[i]).click() --->driver.wait.until(EC.presence_of_element_located((By.XPATH,"xpath4"))) driver.find_element_by_xpath("xpath4").click() import time time.sleep(2) driver.back() i=i+1 import time time.sleep(3) pass passThe loop, number 1,2,3 is good, and in the 4 have a error, it say: raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: He find the f[i], and looks he is bypssing the driver.find_element_by_xpath(f[4]).click() because the error is in driver.wait.until(EC.presence_of_element_located((By.XPATH,"xpath4"))) and of course he eill not find the xpath4 because he dont open the element f[4]. You now why he is bypassing, or another way more efficient to open a element? RE: bypassing find element click() - Larz60+ - Apr-02-2020 It's probably not finding the element 'xpath4' |