Reputation: 159
I am stuck trying to figure out how to get my default driver to open Chrome with an incognito window.
Capybara.default_driver = :selenium_chrome
is what I currently have for my default driver.
How can I add the option that tells the driver to always open an incognito window?
Upvotes: 0
Views: 146
Reputation: 49890
You need to register your own driver which configures Chrome the way you want
Capybara.register_driver :incognito_chrome do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
browser_options.args << '--incognito'
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end
and then set that as your default driver
Capybara.default_driver = :incognito_chrome
Upvotes: 1