Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bypassing find element click()
#1
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?
Reply
#2
It's probably not finding the element 'xpath4'
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to find element in a deeply nested html structure Orientation_group 5 1,125 Oct-09-2023, 10:13 AM
Last Post: Larz60+
  Selenium suddenly fails to find element Pavel_47 3 6,149 Sep-04-2022, 11:06 AM
Last Post: Pavel_47
  Unable to click element in web page Kalpana 0 1,803 Jun-25-2020, 05:20 AM
Last Post: Kalpana
  Find element using xpath engli 3 3,855 May-20-2020, 08:56 AM
Last Post: Larz60+
  find element...click() dont work windows11 6 3,050 Apr-23-2020, 11:13 PM
Last Post: law
  Find Dynamic Input Element Class Problem wazacko 0 1,553 Apr-03-2020, 11:46 AM
Last Post: wazacko
  How find link element zinho 3 3,058 Mar-31-2020, 12:29 PM
Last Post: snippsat
  wait for element and click windows11 2 2,579 Mar-21-2020, 09:23 PM
Last Post: windows11
  How to find which frame/iframe my element belongs to? smaria 1 2,021 Nov-18-2019, 09:21 PM
Last Post: Larz60+
  Click Element if displayed using Selenium and Python giaco__mar 1 3,467 Dec-27-2018, 06:19 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020