Async::WebDriver SourceAsyncWebDriverBridgePool

class Pool

A pool of sessions, constructed from a bridge, which instantiates drivers as needed. Drivers are capable of supporting 1 ore more sessions.

begin
	bridge = Async::WebDriver::Bridge::Pool.start(Async::WebDriver::Bridge::Chrome.new)
	session = bridge.session
ensure
	bridge&.close
end

Nested

Definitions

def initialize(...)

Initialize the session pool.

Signature

parameter bridge Bridge

The bridge to use to create sessions.

Implementation

def initialize(...)
	@controller = Async::Actor.new(BridgeController.new(...))
end

def close

Close the session pool.

Implementation

def close
	@controller.close
end

def session(&block)

Open a session.

Implementation

def session(&block)
	payload = @controller.acquire
	
	session = CachedWrapper.open(payload[:endpoint], payload["sessionId"], payload["capabilities"], pool: self, payload: payload)
	
	return session unless block_given?
	
	begin
		yield session
	ensure
		session&.close
	end
end