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

前端 未结 10 1328
难免孤独
难免孤独 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:09

    Please note that none of the above will work anymore. Element#select and Element#toggle have been deprecated. You need to do something like:

    my_select.click
    my_select.find_elements( :tag_name => "option" ).find do |option|
      option.text == value
    end.click
    

提交回复
热议问题