尝试使用capybara
rspec匹配器have_select(locator,options =
{})代替:
#Find a select box by (label) name or id and assert the given text is selectedThen /^"([^"]*)" should be selected for "([^"]*)"$/ do |selected_text, dropdown| expect(page).to have_select(dropdown, :selected => selected_text)end#Find a select box by (label) name or id and assert the expected option is presentThen /^"([^"]*)" should contain "([^"]*)"$/ do |dropdown, text| expect(page).to have_select(dropdown, :options => [text])end



