I trying automating testing with Selenium (python bindings), specifically want to log in on tokmonet.zendesk.com.
I create a script which takes email field, password field and sign in button by id.
But when I ran script it fails with
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"id","selector":"user_email"}
Inspecting page with Firebug I see these elements. But when trying to get them with Firefinder it couldn't. So, I perform
html_source = driver.page_source
print(html_source)
and get the only
<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>
When I check page source it contains only js scripts and no mark up.
Please advice how I could handle this elements?
You need to switch to the IFRAME
, then send_keys()
to the element which you can find by ID. Don't forget to switch back to the default content if you need to access elements outside the IFRAME
.
driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))
driver.find_element_by_id("user_email").send_keys("username")
driver.find_element_by_id("user_password").send_keys("password")
// do whatever else
driver.switch_to.default_content()