How do I set an option as selected using Selenium WebDriver (selenium 2.0) client in ruby

前端 未结 10 1339
难免孤独
难免孤独 2020-12-14 00:46

I am trying to get familiar with the new ruby selenium-webdriver as it appears more intuitive mostly than the previous version of selenium and the ruby driver that went with

10条回答
  •  遥遥无期
    2020-12-14 01:10

    I don't know what version Selenium this came about, but it looks like there is the Select class that pnewhook mentioned in Selenium 2.20

    http://selenium.googlecode.com/svn-history/r15117/trunk/docs/api/rb/Selenium/WebDriver/Support/Select.html

    option = Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath => "//select"))
    option.select_by(:text, "Edam")
    

提交回复
热议问题