Get select value of dropdown for capybara testing

前端 未结 6 2037
说谎
说谎 2020-12-24 10:33

I have to write tests for a web site. I am trying to get the selected value of a dropdown box. So far i can get the contents of the dropdown by doing

find_f         


        
6条回答
  •  悲哀的现实
    2020-12-24 11:13

    Would something like this work?

    within("//select[@id='restrictions__rating_movies']") do
      find_field("//option[@selected='selected']").text
    end
    

提交回复
热议问题