Error
select = Select(driver.find_element_by_id('id****'))
NameError: name 'Select' is not defined
This error i received when i tried to select value from drop down menu while doing automation in python selenium
How ever i came to know that i was using correct code but some import class is missing from header of file. I need to add "from selenium.webdriver.support.select import Select" in main file or same file so that code will work fine.
Solution:
from selenium.webdriver.support.select import Select
Correct code for click on drop down:
select = Select(driver.find_element_by_id('**id**'))
select.select_by_visible_text('String')
select = Select(driver.find_element_by_id('id****'))
NameError: name 'Select' is not defined
This error i received when i tried to select value from drop down menu while doing automation in python selenium
How ever i came to know that i was using correct code but some import class is missing from header of file. I need to add "from selenium.webdriver.support.select import Select" in main file or same file so that code will work fine.
Solution:
from selenium.webdriver.support.select import Select
Correct code for click on drop down:
select = Select(driver.find_element_by_id('**id**'))
select.select_by_visible_text('String')
Thanks for the solution.It works.
ReplyDeleteThanks it worked
ReplyDelete