Skip to content

Instantly share code, notes, and snippets.

@elliotlarson
Created December 12, 2017 02:05
Show Gist options
  • Select an option

  • Save elliotlarson/c39bf0c8cd6913210ee15acbc841387c to your computer and use it in GitHub Desktop.

Select an option

Save elliotlarson/c39bf0c8cd6913210ee15acbc841387c to your computer and use it in GitHub Desktop.
require 'capybara'
require 'pry'
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
Capybara.default_driver = :selenium
browser = Capybara.current_session
browser.visit('https://google.com')
browser.fill_in('lst-ib', with: 'lorem ipsum')
binding.pry
1
@elliotlarson

Copy link
Copy Markdown
Author

So, basically, you just use the standard Capybara API you are used to using within Rails, but the methods are off of the browser instance.

@stevenchanin

Copy link
Copy Markdown

very cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment