Class: Puppeteer::Launcher::BrowserOptions
- Inherits:
-
Object
- Object
- Puppeteer::Launcher::BrowserOptions
- Defined in:
- lib/puppeteer/launcher/browser_options.rb
Instance Attribute Summary collapse
-
#allow_list ⇒ Object
readonly
Returns the value of attribute allow_list.
-
#block_list ⇒ Object
readonly
Returns the value of attribute block_list.
-
#default_viewport ⇒ Object
readonly
Returns the value of attribute default_viewport.
-
#is_page_target ⇒ Object
readonly
Returns the value of attribute is_page_target.
-
#issues_enabled ⇒ Object
readonly
Returns the value of attribute issues_enabled.
-
#network_enabled ⇒ Object
readonly
Returns the value of attribute network_enabled.
-
#protocol_timeout ⇒ Object
readonly
Returns the value of attribute protocol_timeout.
-
#slow_mo ⇒ Object
readonly
Returns the value of attribute slow_mo.
-
#target_filter ⇒ Object
readonly
Returns the value of attribute target_filter.
Instance Method Summary collapse
- #ignore_https_errors? ⇒ Boolean
-
#initialize(options) ⇒ BrowserOptions
constructor
A new instance of BrowserOptions.
Constructor Details
#initialize(options) ⇒ BrowserOptions
Returns a new instance of BrowserOptions.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 29 def initialize() @ignore_https_errors = [:ignore_https_errors] || false # `default_viewport: nil` must be respected here. @default_viewport = .key?(:default_viewport) ? [:default_viewport] : Puppeteer::Viewport.new(width: 800, height: 600) @slow_mo = [:slow_mo] || 0 @network_enabled = .fetch(:network_enabled, true) @issues_enabled = .fetch(:issues_enabled, true) @protocol_timeout = [:protocol_timeout] @block_list = [:block_list] if @block_list && !@block_list.is_a?(Array) raise ArgumentError.new('block_list must be an Array of URL patterns') end @allow_list = [:allow_list] if @allow_list && !@allow_list.is_a?(Array) raise ArgumentError.new('allow_list must be an Array of URL patterns') end if @block_list && @allow_list raise ArgumentError.new('Cannot specify both blocklist and allowlist') end [*@block_list, *@allow_list].each do |pattern| URLPattern::URLPattern.new(pattern) rescue URLPattern::Error => error raise ArgumentError.new("Invalid URLPattern #{pattern.inspect}: #{error.}") end # only for Puppeteer.connect @target_filter = [: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 = [: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 |
Instance Attribute Details
#allow_list ⇒ Object (readonly)
Returns the value of attribute allow_list.
66 67 68 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 66 def allow_list @allow_list end |
#block_list ⇒ Object (readonly)
Returns the value of attribute block_list.
66 67 68 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 66 def block_list @block_list end |
#default_viewport ⇒ Object (readonly)
Returns the value of attribute default_viewport.
66 67 68 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 66 def @default_viewport end |
#is_page_target ⇒ Object (readonly)
Returns the value of attribute is_page_target.
66 67 68 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 66 def is_page_target @is_page_target end |
#issues_enabled ⇒ Object (readonly)
Returns the value of attribute issues_enabled.
66 67 68 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 66 def issues_enabled @issues_enabled end |
#network_enabled ⇒ Object (readonly)
Returns the value of attribute network_enabled.
66 67 68 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 66 def network_enabled @network_enabled end |
#protocol_timeout ⇒ Object (readonly)
Returns the value of attribute protocol_timeout.
66 67 68 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 66 def protocol_timeout @protocol_timeout end |
#slow_mo ⇒ Object (readonly)
Returns the value of attribute slow_mo.
66 67 68 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 66 def slow_mo @slow_mo end |
#target_filter ⇒ Object (readonly)
Returns the value of attribute target_filter.
66 67 68 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 66 def target_filter @target_filter end |
Instance Method Details
#ignore_https_errors? ⇒ Boolean
68 69 70 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 68 def ignore_https_errors? @ignore_https_errors end |