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

Inherits:
Driver
  • Object
show all
Defined in:
lib/async/webdriver/bridge/safari.rb

Overview

A locally managed ‘safaridriver` process.

Instance Attribute Summary

Attributes inherited from Driver

#count, #status

Instance Method Summary collapse

Methods inherited from Driver

#The status of the driver after a connection has been established.=, #client, #closed?, #concurrency, #endpoint, #ephemeral_port, #port, #reusable?, #viable?

Constructor Details

#initialize(**options) ⇒ Driver

Initialize a managed Safari driver process.



41
42
43
44
# File 'lib/async/webdriver/bridge/safari.rb', line 41

def initialize(**options)
	super(**options)
	@process_group = nil
end

Instance Method Details

#arguments(**options) ⇒ Object



47
48
49
50
51
52
# File 'lib/async/webdriver/bridge/safari.rb', line 47

def arguments(**options)
	[
		options.fetch(:path, "safaridriver"),
		"--port=#{self.port}",
	].compact
end

#closeObject

Stop the managed Safari driver process.



62
63
64
65
66
67
68
69
# File 'lib/async/webdriver/bridge/safari.rb', line 62

def close
	if @process_group
		@process_group.close
		@process_group = nil
	end
	
	super
end

#startObject

Start the managed Safari driver process and wait for readiness.



55
56
57
58
59
# File 'lib/async/webdriver/bridge/safari.rb', line 55

def start
	@process_group = ProcessGroup.spawn(*arguments(**@options))
	
	super
end