Python with selenium: unable to locate element which really exist
The problem is that your input
tag is inside an iframe
, you need to switch to it first:
frame = driver.find_element_by_xpath('//frame[@name="main"]')
driver.switch_to.frame(frame)
pass1 = driver.find_element_by_id("PASSFIELD1")
Add some delay to the driver so that elements will load.
import time
time.sleep(2)
department_element = driver.find_elements_by_id("__id_name__")
or else you can use the following code so that loop runs until the element render
while len(driver.find_elements_by_id("__id_name__")) == 0:
pass
department_element = driver.find_elements_by_id("__id_name__")