-
-
Save strukturedkaos/3801641 to your computer and use it in GitHub Desktop.
Select2.js capybara
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def select2_select(text, options) | |
page.find("#s2id_#{options[:from]} a").click | |
page.all("ul.select2-results li").each do |e| | |
if e.text == text | |
e.click | |
return | |
end | |
end | |
end |
This fork has worked for me: https://gist.github.com/andreierdoss/6313962
A much simpler, cleaner version:
within 'label', :text => input do
first(:xpath, './/..').set value
end
page.find('ul.select2-results li', text: value, visible: true).click()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesn't work: it sees no li's in the DOM. Why could this be?