Skip to content

Instantly share code, notes, and snippets.

@guiferrpereira
Last active December 18, 2015 00:48
Show Gist options
  • Save guiferrpereira/5698918 to your computer and use it in GitHub Desktop.
Save guiferrpereira/5698918 to your computer and use it in GitHub Desktop.
Capybara with phantomjs
require 'capybara'
require 'capybara/poltergeist'
# Capybara configuration
Capybara.run_server = false
Capybara.javascript_driver = :poltergeist
Capybara.default_wait_time = 10
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, { :phantomjs_options => ['--ignore-ssl-errors=yes'] })
end
# Capybara initializer
session = Capybara::Session.new(:poltergeist)
session.visit 'http://xpto.com:8001/'
session.fill_in 'user', :with => '[email protected]'
session.fill_in 'pass', :with => 'cool1111'
session.click_button('Entrar')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment