Created
June 7, 2013 15:00
-
-
Save buru/5729885 to your computer and use it in GitHub Desktop.
Select the first item from Ajax-Chosen field using Capybara with Selenium web driver
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 select_from_ajax_chosen(item_text, field_id) | |
within "##{field_id}_chzn" do | |
find('a.chzn-single').click | |
input = find("div.chzn-search input") | |
item_text.each_char do |char| | |
input.native.send_keys char | |
end | |
sleep 1 | |
input.native.send_keys :arrow_down | |
input.native.send_keys :return | |
within 'a.chzn-single' do | |
page.should have_content item_text | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment