Class: Puppeteer::Launcher::Chrome::DefaultArgs
- Inherits:
-
Object
- Object
- Puppeteer::Launcher::Chrome::DefaultArgs
- Includes:
- Enumerable
- Defined in:
- lib/puppeteer/launcher/chrome.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(chrome_arg_options) ⇒ DefaultArgs
constructor
A new instance of DefaultArgs.
Constructor Details
#initialize(chrome_arg_options) ⇒ DefaultArgs
Returns a new instance of DefaultArgs.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/puppeteer/launcher/chrome.rb', line 94 def initialize() chrome_arguments = [ '--disable-background-networking', '--enable-features=NetworkService,NetworkServiceInProcess', '--disable-background-timer-throttling', '--disable-backgrounding-occluded-windows', '--disable-breakpad', '--disable-client-side-phishing-detection', '--disable-component-extensions-with-background-pages', '--disable-default-apps', '--disable-dev-shm-usage', '--disable-extensions', '--disable-features=Translate', '--disable-hang-monitor', '--disable-ipc-flooding-protection', '--disable-popup-blocking', '--disable-prompt-on-repost', '--disable-renderer-backgrounding', '--disable-sync', '--force-color-profile=srgb', '--metrics-recording-only', '--no-first-run', '--enable-automation', '--password-store=basic', '--use-mock-keychain', # TODO(sadym): remove '--enable-blink-features=IdleDetection' # once IdleDetection is turned on by default. '--enable-blink-features=IdleDetection', ] if .user_data_dir chrome_arguments << "--user-data-dir=#{.user_data_dir}" end if .devtools? chrome_arguments << '--auto-open-devtools-for-tabs' end if .headless? chrome_arguments.concat([ '--headless', '--hide-scrollbars', '--mute-audio', ]) end if .args.all? { |arg| arg.start_with?('-') } chrome_arguments << 'about:blank' end chrome_arguments.concat(.args) @chrome_arguments = chrome_arguments end |
Instance Method Details
#each(&block) ⇒ Object
149 150 151 152 153 |
# File 'lib/puppeteer/launcher/chrome.rb', line 149 def each(&block) @chrome_arguments.each do |opt| block.call(opt) end end |