Sha256: 387e1ca39120d26e0392a85baf9d0f47274f635717c1c562dfec33e4857ef009

Contents?: true

Size: 1.57 KB

Versions: 17

Compression:

Stored size: 1.57 KB

Contents

# const {
#   ignoreDefaultArgs = false,
#   args = [],
#   dumpio = false,
#   executablePath = null,
#   pipe = false,
#   env = process.env,
#   handleSIGINT = true,
#   handleSIGTERM = true,
#   handleSIGHUP = true,
#   ignoreHTTPSErrors = false,
#   defaultViewport = {width: 800, height: 600},
#   slowMo = 0,
#   timeout = 30000
# } = options;
# const {
#   devtools = false,
#   headless = !devtools,
#   args = [],
#   userDataDir = null
# } = options;


module Puppeteer::Launcher
  class BrowserOptions
    # @property {boolean=} ignoreHTTPSErrors
    # @property {(?Puppeteer.Viewport)=} defaultViewport
    # @property {number=} slowMo
    def initialize(options)
      @ignore_https_errors = options[:ignore_https_errors] || false
      # `default_viewport: nil` must be respected here.
      @default_viewport = options.key?(:default_viewport) ? options[:default_viewport] : Puppeteer::Viewport.new(width: 800, height: 600)
      @slow_mo = options[:slow_mo] || 0

      # only for Puppeteer.connect
      @target_filter = options[:target_filter]
      if @target_filter && !@target_filter.respond_to?(:call)
        raise ArgumentError.new('target_filter must be a Proc (target_info => true/false)')
      end

      @is_page_target = options[:is_page_target]
      if @is_page_target && !@is_page_target.respond_to?(:call)
        raise ArgumentError.new('is_page_target must be a Proc (target_info => true/false)')
      end
    end

    attr_reader :default_viewport, :slow_mo, :target_filter, :is_page_target

    def ignore_https_errors?
      @ignore_https_errors
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
puppeteer-ruby-0.45.6 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.45.5 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.45.4 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.45.3 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.45.2 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.45.2.alpha2 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.45.2.alpha1 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.45.1 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.45.0 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.44.3 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.44.2 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.44.1 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.44.0 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.43.1 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.43.0 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.42.0 lib/puppeteer/launcher/browser_options.rb
puppeteer-ruby-0.41.0 lib/puppeteer/launcher/browser_options.rb