How to select option in drop down using Capybara

后端 未结 9 1136
终归单人心
终归单人心 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:33

    none of the answers worked for me in 2017 with capybara 2.7. I got "ArgumentError: wrong number of arguments (given 2, expected 0)"

    But this did:

    find('#organizationSelect').all(:css, 'option').find { |o| o.value == 'option_name_here' }.select_option
    

提交回复
热议问题