5

In my spec_helper file I have:

  Capybara.javascript_driver = :webkit

capybara_webkit now has a ignore_ssl_errors option that I want to use. How do I specify that in my spec_helper?

fabdurso
  • 2,366
  • 5
  • 29
  • 55
deb
  • 12,326
  • 21
  • 67
  • 86

5 Answers5

3

Here's how to register the :webkit driver with the :ignore_ssl_errors option.

Capybara.register_driver :webkit do |app|
  Capybara::Driver::Webkit.new(app, :ignore_ssl_errors => true)
end
jaredjacobs
  • 5,625
  • 2
  • 27
  • 23
3

As of writing (capybara-webkit 1.7.1), the configuration seems to have been simplified:

Capybara::Webkit.configure do |config|
  config.ignore_ssl_errors
end

(source)

Kevin Qi
  • 3,220
  • 2
  • 22
  • 24
2

Somehow the above register_driver examples don't work with Capybara 1.1.4. The example below is taken from the capybara browser_spec.rb.

Capybara.register_driver :webkit_ignore_ssl do |app|
  browser = Capybara::Webkit::Browser.new(Capybara::Webkit::Connection.new).tap do |browser|
    browser.ignore_ssl_errors
  end
  Capybara::Webkit::Driver.new(app, :browser => browser)
end
Capybara.javascript_driver = :webkit_ignore_ssl
hjblok
  • 2,936
  • 22
  • 20
2

As @hjblok says, the interface has changed in recent versions of capybara-webkit. You can simplify the solution slightly:

Capybara.register_driver :webkit_ignore_ssl do |app|
  Capybara::Webkit::Driver.new(app).tap {|d| d.browser.ignore_ssl_errors }
end
Capybara.javascript_driver = :webkit_ignore_ssl
Andrew France
  • 4,758
  • 1
  • 25
  • 27
0

When createing a new webkit Object you can use this to ignore the ssl errors

Capybara::Driver::Webkit.new({ :ignore_ssl_errors => true})
davidb
  • 8,884
  • 4
  • 36
  • 72