Note that there are some explanatory texts on larger screens.

plurals
  1. POCucumber how to simulate multiple drop down selection?
    text
    copied!<p>Hi I'm new to Cucumber and Ruby on Rails, and I can't figure out how to simulate multiple drop down menu selection. I am able to do it for a single drop down menu (in my case "Rating").</p> <pre><code>Given /the following movies exist:$/ do |movies_table| movies_table.hashes.each do |movie| # each returned element will be a hash whose key is the table header. # you should arrange to add that movie to the database here. Given %Q{I am on the Create New Movie page} When %Q{I fill in "Title" with "#{movie[:title]}"} And %Q{I select "#{movie[:rating]}" from "Rating"} And %Q{I select "#{movie[:release_date]}" from "Released On"} And %Q{I press "Save Changes"} end assert false, "Unimplmemented" end </code></pre> <p>The error that i believe is relevant to my problem is.</p> <pre><code>cannot select option, no select box with id, name, or label 'Released On' found (Capybara::ElementNotFound) (eval):2:in `select' ./step_definitions/web_steps.rb:86:in `/^(?:|I )select "([^"]*)" from "([^"]*)"$/' filter_movie_list.feature:9:in `Given the following movies exist:' </code></pre> <p>What I believe is the relevant source code from my web app is</p> <pre><code> &lt;label for="movie_title"&gt;Title&lt;/label&gt; &lt;input id="movie_title" name="movie[title]" size="30" type="text" /&gt; &lt;label for="movie_rating"&gt;Rating&lt;/label&gt; &lt;select id="movie_rating" name="movie[rating]"&gt;&lt;option value="G"&gt;G&lt;/option&gt; &lt;option value="PG"&gt;PG&lt;/option&gt; &lt;option value="PG-13"&gt;PG-13&lt;/option&gt; &lt;option value="R"&gt;R&lt;/option&gt; &lt;option value="NC-17"&gt;NC-17&lt;/option&gt;&lt;/select&gt; &lt;label for="movie_release_date"&gt;Released On&lt;/label&gt; &lt;select id="movie_release_date_1i" name="movie[release_date(1i)]"&gt; &lt;option value="2007"&gt;2007&lt;/option&gt; &lt;option value="2008"&gt;2008&lt;/option&gt; &lt; And so on ...&gt; &lt;/select&gt; &lt;select id="movie_release_date_3i" name="movie[release_date(3i)]"&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;option value="6"&gt;6&lt;/option&gt; &lt;option value="7"&gt;7&lt;/option&gt; &lt; And so on ...&gt; &lt;/select&gt; &lt;input name="commit" type="submit" value="Save Changes" /&gt; </code></pre> <p>So I am refered to the label "Released On" but my error message says it has no select box, yet it works for the Rating. Also from my .feature file is in the form of</p> <pre><code>25-Nov-1992 </code></pre> <p>If it plays a part at all. But I assumed not since since I think ruby understands how to handle dates. Thank you for your time.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload