Class: Unmagic::Browser::Driver::Local
- Defined in:
- lib/unmagic/browser/driver/local.rb
Overview
Chrome on this machine.
The development default, and the only driver where you can watch what's
happening: headless: false opens a real window, which is how a person
gets to solve a captcha mid-session and hand control back.
Constant Summary collapse
- DEFAULT_ARGS =
Chrome flags that only make sense for automation.
--no-sandboxis what lets Chrome run as root inside a container, which is where CI lives. [ "--disable-dev-shm-usage", "--no-sandbox", "--disable-gpu", ].freeze
Constants inherited from Base
Base::DEFAULT_TIMEOUT, Base::WAIT_UNTIL
Instance Attribute Summary collapse
-
#args ⇒ Array<String>
readonly
The flags Chrome is launched with.
-
#executable_path ⇒ String?
readonly
The Chrome binary to run, or nil to let Puppeteer find one.
-
#headless ⇒ Boolean
readonly
Whether Chrome runs without a window.
Instance Method Summary collapse
-
#initialize(headless: true, executable_path: nil, args: [], slow_mo: nil) ⇒ Local
constructor
A new instance of Local.
Methods inherited from Base
#close, #html, #markdown, #name, #open_connection, #pdf, #screenshot
Constructor Details
#initialize(headless: true, executable_path: nil, args: [], slow_mo: nil) ⇒ Local
Returns a new instance of Local.
39 40 41 42 43 44 45 |
# File 'lib/unmagic/browser/driver/local.rb', line 39 def initialize(headless: true, executable_path: nil, args: [], slow_mo: nil) super() @headless = headless @executable_path = executable_path @args = (DEFAULT_ARGS + args).uniq.freeze @slow_mo = slow_mo end |
Instance Attribute Details
#args ⇒ Array<String> (readonly)
Returns the flags Chrome is launched with.
33 34 35 |
# File 'lib/unmagic/browser/driver/local.rb', line 33 def args @args end |
#executable_path ⇒ String? (readonly)
Returns the Chrome binary to run, or nil to let Puppeteer find one.
30 31 32 |
# File 'lib/unmagic/browser/driver/local.rb', line 30 def executable_path @executable_path end |
#headless ⇒ Boolean (readonly)
Returns whether Chrome runs without a window.
27 28 29 |
# File 'lib/unmagic/browser/driver/local.rb', line 27 def headless @headless end |