1

I am trying to find an element on a webpage (https://www.fimea.fi/web/en/databases_and_registeries/spcs/human_medicinal_products) using Selenium and Python and I want to find the first text input for name of the medicinal product.

I am getting this error:

Message: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@name='nimi'][@type='text']"}

I am currently using the code below:

clear_button = driver.find_element_by_xpath("//input[@name='nimi'][@type='text']")

I am new to Python and Selenium. Please help me out on this.

1
  • Please add the html of the element you are looking for. Commented Feb 12, 2020 at 15:53

2 Answers 2

1

The field you are looking for is inside an iframe. You need to identify and switch to that iframe first.

iframe=driver.switch_to.frame('_com_liferay_iframe_web_portlet_IFramePortlet_INSTANCE_1UG85fOFT8Za_iframe')
input_field = driver.find_element_by_xpath("//input[@name='nimi']")
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I am able to locate it now.
0

The reason why you can't locate the element is that the input box is hiden by a frame. Maybe you should use switch_to.frame() to switch to it. F12 screenshot

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.