Skip to content

Instantly share code, notes, and snippets.

@justin808
Created March 10, 2014 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justin808/9461067 to your computer and use it in GitHub Desktop.
Save justin808/9461067 to your computer and use it in GitHub Desktop.
Capybara, Poltergeist, typeahead.js
def fill_in_autocomplete(selector, value)
script = %Q{ $('#{selector}').val('#{value}').focus().keypress() }
page.execute_script(script)
end
def choose_autocomplete(text)
expect(page).to have_css(".tt-suggestion p", text: text, visible: false)
script = %Q{ $('.tt-suggestion:contains("#{text}")').click() }
page.execute_script(script)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment