Class: Ferrum::Browser::Options::Chrome
- Defined in:
- lib/ferrum/browser/options/chrome.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ "headless" => nil, "disable-gpu" => nil, "hide-scrollbars" => nil, "mute-audio" => nil, "enable-automation" => nil, "disable-web-security" => nil, "disable-session-crashed-bubble" => nil, "disable-breakpad" => nil, "disable-sync" => nil, "no-first-run" => nil, "use-mock-keychain" => nil, "keep-alive-for-test" => nil, "disable-popup-blocking" => nil, "disable-extensions" => nil, "disable-hang-monitor" => nil, "disable-features" => "site-per-process,TranslateUI", "disable-translate" => nil, "disable-background-networking" => nil, "enable-features" => "NetworkService,NetworkServiceInProcess", "disable-background-timer-throttling" => nil, "disable-backgrounding-occluded-windows" => nil, "disable-client-side-phishing-detection" => nil, "disable-default-apps" => nil, "disable-dev-shm-usage" => nil, "disable-ipc-flooding-protection" => nil, "disable-prompt-on-repost" => nil, "disable-renderer-backgrounding" => nil, "force-color-profile" => "srgb", "metrics-recording-only" => nil, "safebrowsing-disable-auto-update" => nil, "password-store" => "basic", # Note: --no-sandbox is not needed if you properly setup a user in the container. # https://github.com/ebidel/lighthouse-ci/blob/master/builder/Dockerfile#L35-L40 # "no-sandbox" => nil, }.freeze
- MAC_BIN_PATH =
[ "/Applications/Chromium.app/Contents/MacOS/Chromium", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ].freeze
- LINUX_BIN_PATH =
%w[chromium google-chrome-unstable google-chrome-beta google-chrome chrome chromium-browser google-chrome-stable].freeze
Constants inherited from Base
Base::BROWSER_HOST, Base::BROWSER_PORT
Instance Method Summary collapse
Methods inherited from Base
#detect_path, #except, options, #to_h
Instance Method Details
#merge_default(flags, options) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/ferrum/browser/options/chrome.rb', line 62 def merge_default(flags, ) unless .fetch(:headless, true) defaults = except("headless", "disable-gpu") end defaults ||= DEFAULT_OPTIONS defaults.merge(flags) end |
#merge_required(flags, options, user_data_dir) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/ferrum/browser/options/chrome.rb', line 52 def merge_required(flags, , user_data_dir) port = .fetch(:port, BROWSER_PORT) host = .fetch(:host, BROWSER_HOST) flags.merge("remote-debugging-port" => port, "remote-debugging-address" => host, # Doesn't work on MacOS, so we need to set it by CDP "window-size" => [:window_size].join(","), "user-data-dir" => user_data_dir) end |