1

The elements of the drop down list im trying to use.

using

from selenium.webdriver.support.ui import Select

# my current attempt 
OrderStatus = Select(driver.find_element_by_xpath("//select[@class='status-filter']"))
OrderStatus.select_by_index("2")

error -

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//select[@class='status-filter']"} (Session info: chrome=91.0.4472.124)*

0

1 Answer 1

0

Your element is inside an iframe.
You first need to switch to that iframe and only after that will be able to access elements inside it.

driver.switch_to.frame(driver.find_element_by_id("moduleManagement"))
Sign up to request clarification or add additional context in comments.

3 Comments

Firstly, thanks for the response!! secondly do you have an example on how i can do it with my current elements ? OrderStatus=Select(driver.find_element_by_xpath("//iframe[@id='moduleManagement']/select[@class='status-filter']"))
No, you perform switching to the iframe. After that you are working regularly. When you will need to access elements out of the iframe you will have to switch to the default content
Works! thanks you. driver.switch_to.frame(driver.find_element_by_id("moduleManagement")) OrderStatus = Select(driver.find_element_by_class_name("status-filter")) OrderStatus.select_by_value("2")

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.