Class: Puppeteer::Launcher::Firefox::DefaultArgs

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/puppeteer/launcher/firefox.rb

Instance Method Summary collapse

Constructor Details

#initialize(chrome_arg_options) ⇒ DefaultArgs

Returns a new instance of DefaultArgs.

Parameters:



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/puppeteer/launcher/firefox.rb', line 163

def initialize(chrome_arg_options)
  firefox_arguments = ['--no-remote']

  if Puppeteer.env.darwin?
    firefox_arguments << '--foreground'
  elsif Puppeteer.env.windows?
    firefox_arguments << '--wait-for-browser'
  end

  if chrome_arg_options.user_data_dir
    firefox_arguments << "--profile"
    firefox_arguments << chrome_arg_options.user_data_dir
  end

  if chrome_arg_options.headless?
    firefox_arguments << '--headless'
  end

  if chrome_arg_options.devtools?
    firefox_arguments << '--devtools'
  end

  if chrome_arg_options.args.all? { |arg| arg.start_with?('-') }
    firefox_arguments << 'about:blank'
  end

  firefox_arguments.concat(chrome_arg_options.args)

  @firefox_arguments = firefox_arguments
end

Instance Method Details

#each(&block) ⇒ Object



194
195
196
197
198
# File 'lib/puppeteer/launcher/firefox.rb', line 194

def each(&block)
  @firefox_arguments.each do |opt|
    block.call(opt)
  end
end