How to select option in drop down using Capybara

后端 未结 9 1134
终归单人心
终归单人心 2020-12-23 23:47

I\'m trying to select an item from a drop down menu using Capybara (2.1.0).

I want to select by number (meaning select the second, third, etc option).

I\'ve

9条回答
  •  执念已碎
    2020-12-24 00:38

    another option is to add a method like this

      def select_option(css_selector, value)
        find(:css, css_selector).find(:option, value).select_option
      end
    

提交回复
热议问题