lib/capybara/webmock.rb in capybara-webmock-0.5.2 vs lib/capybara/webmock.rb in capybara-webmock-0.5.3

- old
+ new

@@ -66,13 +66,19 @@ profile["network.proxy.ssl_port"] = port_number profile end def chrome_options - {args: [ "--proxy-server=127.0.0.1:#{port_number}" ]} + ::Selenium::WebDriver::Chrome::Options.new.tap do |options| + options.add_argument "--proxy-server=127.0.0.1:#{port_number}" + end end + def chrome_headless_options + chrome_options.tap { |options| options.headless! } + end + def phantomjs_options ["--proxy=127.0.0.1:#{port_number}"] end private @@ -160,12 +166,14 @@ Capybara.register_driver :capybara_webmock do |app| Capybara::Selenium::Driver.new(app, browser: :firefox, profile: Capybara::Webmock.firefox_profile) end Capybara.register_driver :capybara_webmock_chrome do |app| - Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: { - chromeOptions: Capybara::Webmock.chrome_options - }) + Capybara::Selenium::Driver.new(app, browser: :chrome, options: Capybara::Webmock.chrome_options) +end + +Capybara.register_driver :capybara_webmock_chrome_headless do |app| + Capybara::Selenium::Driver.new(app, browser: :chrome, options: Capybara::Webmock.chrome_headless_options) end Capybara.register_driver :capybara_webmock_poltergeist do |app| Capybara::Poltergeist::Driver.new(app, phantomjs_options: Capybara::Webmock.phantomjs_options) end