Python Forum

Full Version: bypassing find element click()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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

	pass
The 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?
It's probably not finding the element 'xpath4'