Class: Async::WebDriver::Bridge::Safari

Inherits:
Generic
  • Object
show all
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

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 Safari browser which need to be provided when requesting a new session.



80
81
82
83
84
85
86
# File 'lib/async/webdriver/bridge/safari.rb', line 80

def default_capabilities(headless: self.headless?)
	{
		alwaysMatch: {
			browserName: "safari",
		},
	}
end

#driver_pathObject



24
25
26
# File 'lib/async/webdriver/bridge/safari.rb', line 24

def driver_path
	@options.fetch(:driver_path, "safaridriver")
end

#start(**options) ⇒ Object

Start the driver.



73
74
75
# File 'lib/async/webdriver/bridge/safari.rb', line 73

def start(**options)
	Driver.new(**@options, **options).tap(&:start)
end

#versionObject



29
30
31
32
33
34
35
# File 'lib/async/webdriver/bridge/safari.rb', line 29

def version
	::IO.popen([self.driver_path, "--version"]) do |io|
		return io.read
	end
rescue Errno::ENOENT
	return nil
end