Class: Async::WebDriver::Bridge::Safari
- Defined in:
- lib/async/webdriver/bridge/safari.rb
Overview
A bridge to the Safari browser using ‘safaridriver`.
“‘ ruby begin bridge = Async::WebDriver::Bridge::Safari.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 Safari browser which need to be provided when requesting a new session.
- #path ⇒ Object
-
#start(**options) ⇒ Object
Start the driver.
- #version ⇒ Object
Methods inherited from Generic
#headless?, #initialize, start, #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 Safari browser which need to be provided when requesting a new session.
74 75 76 77 78 79 80 |
# File 'lib/async/webdriver/bridge/safari.rb', line 74 def default_capabilities(headless: self.headless?) { alwaysMatch: { browserName: "safari", }, } end |
#path ⇒ Object
23 24 25 |
# File 'lib/async/webdriver/bridge/safari.rb', line 23 def path @options.fetch(:path, "safaridriver") end |
#start(**options) ⇒ Object
Start the driver.
67 68 69 |
# File 'lib/async/webdriver/bridge/safari.rb', line 67 def start(**) Driver.new(**).tap(&:start) end |
#version ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/async/webdriver/bridge/safari.rb', line 28 def version ::IO.popen([self.path, "--version"]) do |io| return io.read end rescue Errno::ENOENT return nil end |