嗨,我是新来的Cucumber和Ruby on Rails,我不知道如何模拟多个下拉菜单选择。我能够做到一个单一的下拉菜单(在我的情况“评级”)。黄瓜如何模拟多个下拉选择?
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
我认为与我的问题有关的错误是。
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:'
我相信是从我的web应用程序相关的源代码是
<label for="movie_title">Title</label>
<input id="movie_title" name="movie[title]" size="30" type="text" />
<label for="movie_rating">Rating</label>
<select id="movie_rating" name="movie[rating]"><option value="G">G</option>
<option value="PG">PG</option>
<option value="PG-13">PG-13</option>
<option value="R">R</option>
<option value="NC-17">NC-17</option></select>
<label for="movie_release_date">Released On</label>
<select id="movie_release_date_1i" name="movie[release_date(1i)]">
<option value="2007">2007</option>
<option value="2008">2008</option>
< And so on ...>
</select>
<select id="movie_release_date_3i" name="movie[release_date(3i)]">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
< And so on ...>
</select>
<input name="commit" type="submit" value="Save Changes" />
所以我refered为“发布”,但我的错误消息说,它没有选择框的标签,但它适用于评级。也从我的.feature文件是在
25-Nov-1992
的形式如果它根本起不到作用。但自从我认为ruby理解如何处理日期以来,我就没有假设。感谢您的时间。