Class: Async::WebDriver::Bridge::Firefox
- Defined in:
- lib/async/webdriver/bridge/firefox.rb
Overview
A bridge to the Firefox browser using ‘geckodriver`.
“‘ ruby begin bridge = Async::WebDriver::Bridge::Firefox.start client = Async::WebDriver::Client.open(bridge.endpoint) ensure bridge&.close end
Defined Under Namespace
Classes: Driver
Instance Method Summary collapse
-
#default_capabilities(headless: self.headless?) ⇒ Object
The default capabilities for the Firefox browser which need to be provided when requesting a new session.
- #driver_path ⇒ Object
-
#start(**options) ⇒ Object
Start the driver.
- #version ⇒ Object
Methods inherited from Generic
#headless?, #initialize, #supported?
Constructor Details
This class inherits a constructor from Async::WebDriver::Bridge::Generic
Instance Method Details
#default_capabilities(headless: self.headless?) ⇒ Object
The default capabilities for the Firefox browser which need to be provided when requesting a new session.
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/async/webdriver/bridge/firefox.rb', line 84 def default_capabilities(headless: self.headless?) { alwaysMatch: { browserName: "firefox", "moz:firefoxOptions": { args: [headless ? "-headless" : nil].compact, } } } end |
#driver_path ⇒ Object
23 24 25 |
# File 'lib/async/webdriver/bridge/firefox.rb', line 23 def driver_path @options.fetch(:driver_path, "geckodriver") end |
#start(**options) ⇒ Object
Start the driver.
77 78 79 |
# File 'lib/async/webdriver/bridge/firefox.rb', line 77 def start(**) Driver.new(**@options, **).tap(&:start) end |
#version ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/async/webdriver/bridge/firefox.rb', line 28 def version ::IO.popen([self.driver_path, "--version"]) do |io| return io.read end rescue Errno::ENOENT return nil end |