Class: Puppeteer::Launcher::BrowserOptions
- Inherits:
-
Object
- Object
- Puppeteer::Launcher::BrowserOptions
- Defined in:
- lib/puppeteer/launcher/browser_options.rb
Instance Attribute Summary collapse
-
#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 |
# 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 # 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
#block_list ⇒ Object (readonly)
Returns the value of attribute block_list.
54 55 56 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 54 def block_list @block_list end |
#default_viewport ⇒ Object (readonly)
Returns the value of attribute default_viewport.
54 55 56 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 54 def @default_viewport end |
#is_page_target ⇒ Object (readonly)
Returns the value of attribute is_page_target.
54 55 56 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 54 def is_page_target @is_page_target end |
#issues_enabled ⇒ Object (readonly)
Returns the value of attribute issues_enabled.
54 55 56 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 54 def issues_enabled @issues_enabled end |
#network_enabled ⇒ Object (readonly)
Returns the value of attribute network_enabled.
54 55 56 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 54 def network_enabled @network_enabled end |
#protocol_timeout ⇒ Object (readonly)
Returns the value of attribute protocol_timeout.
54 55 56 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 54 def protocol_timeout @protocol_timeout end |
#slow_mo ⇒ Object (readonly)
Returns the value of attribute slow_mo.
54 55 56 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 54 def slow_mo @slow_mo end |
#target_filter ⇒ Object (readonly)
Returns the value of attribute target_filter.
54 55 56 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 54 def target_filter @target_filter end |
Instance Method Details
#ignore_https_errors? ⇒ Boolean
56 57 58 |
# File 'lib/puppeteer/launcher/browser_options.rb', line 56 def ignore_https_errors? @ignore_https_errors end |