0 votes
1 view
in Devops and Agile by (20k points)

How do I use Capybara to check that a select box has certain values listed as options? It has to be compatible with Selenium...

This is the HTML that I have:

<select id="cars"> 

  <option></option>

  <option value="volvo">Volvo</option>

  <option value="saab">Saab</option>

  <option value="mercedes">Mercedes</option>

  <option value="audi">Audi</option>

</select>

This is what I want to do:

Then the "cars" field should contain the option "audi"

1 Answer

0 votes
by (28.4k points)

This code should do the magic:

page.all('select#cars option').map(&:value).should == %w(volvo saab mercedes audi)

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...