How to get selected option using Selenium WebDriver with Python?

后端 未结 1 1852
广开言路
广开言路 2021-01-01 18:23

How to get selected option using Selenium WebDriver with Python:

Someone have a solution for a getFirstSelectedOption?

I\'m using this to get th

相关标签:
1条回答
  • 2021-01-01 19:14

    This is something that selenium makes it easy to deal with - the Select class:

    from selenium.webdriver.support.select import Select
    
    select = Select(driver.find_element_by_id('FCenter'))
    selected_option = select.first_selected_option
    print selected_option.text
    
    0 讨论(0)
提交回复
热议问题