Async::WebDriver SourceAsyncWebDriverBridgeSafari

class Safari

A bridge to the Safari browser using safaridriver.

begin
	bridge = Async::WebDriver::Bridge::Safari.start
	client = Async::WebDriver::Client.open(bridge.endpoint)
ensure
	bridge&.close
end

Nested

Definitions

def version

Signature

returns String

The version of the safaridriver executable.

Implementation

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

def start(**options)

Start the driver.

Implementation

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

def default_capabilities(headless: self.headless?)

The default capabilities for the Safari browser which need to be provided when requesting a new session.

Signature

parameter headless Boolean

Whether to run the browser in headless mode.

returns Hash

The default capabilities for the Safari browser.

Implementation

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