Skip to content

Instantly share code, notes, and snippets.

@gbpereira
Last active May 17, 2019 19:49
Show Gist options
  • Save gbpereira/0a2b526970a40ccb38842355de97e92c to your computer and use it in GitHub Desktop.
Save gbpereira/0a2b526970a40ccb38842355de97e92c to your computer and use it in GitHub Desktop.
Useful commands to work with capybara and rails
# trigger event
def trigger_event(jquery_element, event)
page.execute_script("$('#{jquery_element}').trigger('#{event}')")
end
# write html page to file
File.write('output.html', page.html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment