lib/browsed/firefox.rb in browsed-0.1.7 vs lib/browsed/firefox.rb in browsed-0.1.8
- old
+ new
@@ -1,10 +1,11 @@
module Browsed
module Firefox
private
def register_firefox_driver(driver_options: {}, timeout: 60, debug: false)
+ headless = driver_options.fetch(:headless, false)
download_path = driver_options.fetch(:download_path, self.configuration.download_path)
private_browsing = driver_options.fetch(:private_browsing, false)
profile = Selenium::WebDriver::Firefox::Profile.new
@@ -23,9 +24,10 @@
profile["general.useragent.override"] = self.user_agent unless self.user_agent.to_s.empty?
profile = firefox_proxy_options(profile)
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
+ options.args << "--headless" if headless
Capybara.register_driver self.driver do |app|
Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
end
end