Saturday, 15 September 2012

Python with selenium: unable to locate element which really exist -



Python with selenium: unable to locate element which really exist -

i've been trying fill input:

<input id="passfield1" class="logfield" type="password" onkeyup="next(this, event);" maxlength="1" autocomplete="off" name="passfield1"></input>

to this, have find element.

i tried below things:

pass1=driver.find_element_by_name("passfield1")

pass1=driver.find_element_by_id("passfield1")

pass1= driver.find_element_by_xpath("/html/body/div[4]/div/div/div[2]/div/form/div[3]/table/tbody/tr[3]/td[2]/div/input[1]") (path firebug)

even wait 100 seconds

self.wait.until(ec.visibility_of_element_located((by.xpath,"/html/body/div[4]/div/div/div[2]/div/form/div[3]/table/tbody/tr[3]/td[2]/div/input[1]"))) self.asserttrue(self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div[2]/div/form/div[3]/table/tbody/tr[3]/td[2]/div/input[1]"))

i get:

selenium.common.exceptions.nosuchelementexception: message: 'unable locate element: (...)

do know doing wrong?

the problem input tag within iframe, need switch to first:

frame = driver.find_element_by_xpath('//frame[@name="main"]') driver.switch_to.frame(frame) pass1 = driver.find_element_by_id("passfield1")

python selenium selenium-webdriver

No comments:

Post a Comment