Skip to content

Instantly share code, notes, and snippets.

@joshski
Created January 22, 2013 17:22
Show Gist options
  • Save joshski/4596443 to your computer and use it in GitHub Desktop.
Save joshski/4596443 to your computer and use it in GitHub Desktop.
capybara mechanize headers
# capybara '1.1.2
require 'capybara'
require 'capybara/dsl'
require 'capybara/mechanize'
Capybara.default_driver = :mechanize
Capybara.app_host = 'http://httpbin.org'
include Capybara::DSL
Capybara.current_session.driver.browser.agent.set_proxy ('www-cache.reith.bbc.co.uk', 80)
Capybara.current_session.driver.browser.agent.request_headers = {"X-Header" => "value"}
visit '/headers'
puts page.find('p').text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment