Skip to content

Instantly share code, notes, and snippets.

@yannis
Last active July 21, 2016 12:39
Show Gist options
  • Save yannis/4665021 to your computer and use it in GitHub Desktop.
Save yannis/4665021 to your computer and use it in GitHub Desktop.
Chose an option from a select2.js dropdown menu in cucumber
When /^I chose "(.*?)" in the "(.*?)" select2 menu$/ do |value, placeholder|
container = page.find('.select2-container', text: placeholder)
container.find('a.select2-choice').click
input = container.find("input[type='text']")
input.set(value)
sleep 1
li = container.find('li', text: value)
li.click
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment