sn3jd3r
sn3jd3r

Reputation: 506

Problems with typing text using splinter

I want to type text, and send it like showed in the following link example of form to be filled out.

I am however unable to type anything in the field. I supposed at first it was an iframe, but splinter is unable to locate it. If i search by tags for the body, it says that:

selenium.common.exceptions.WebDriverException: Message: unknown error: cannot focus element

How might i go about fixing this?

Upvotes: 0

Views: 229

Answers (1)

Kushal Bhalaik
Kushal Bhalaik

Reputation: 3384

if your element is not focused you have to first move to that element using selenium actions as following:

first move to using ;

driver.switch_to.frame(driver.find_element_by_css_selector("#inquiry-content_ifr"))

Then focus on element

yourElement= driver.find_element_by_css_selector(".nav")

actions = ActionChains(driver)
actions.move_to_element(menu)

actions.perform()

then do your interaction with that element after focus has been set to the element.

Upvotes: 1

Related Questions