Async::WebDriver SourceAsyncWebDriverBridge

module Bridge

A bridge is a process that can be used to communicate with a browser. It is not needed in all cases, but is useful when you want to run integration tests without any external drivers/dependencies. As starting a bridge can be slow, it is recommended to use a shared bridge when possible.

Nested

Definitions

ASYNC_WEBDRIVER_BRIDGE = 'ASYNC_WEBDRIVER_BRIDGE'

The environment variable used to select a bridge.

ASYNC_WEBDRIVER_BRIDGE=Chrome
ASYNC_WEBDRIVER_BRIDGE=Firefox

ASYNC_WEBDRIVER_BRIDGE_HEADLESS = 'ASYNC_WEBDRIVER_BRIDGE_HEADLESS'

The environment variable used to disable headless mode.

ASYNC_WEBDRIVER_BRIDGE_HEADLESS=false

def self.default(env = ENV, **options)

Signature

returns Bridge

The default bridge to use.

Implementation

def self.default(env = ENV, **options)
	if env[ASYNC_WEBDRIVER_BRIDGE_HEADLESS] == "false"
		options[:headless] = false
	end
	
	if name = env[ASYNC_WEBDRIVER_BRIDGE]
		self.const_get(name).mew(**options)
	else
		ALL.each do |klass|
			instance = klass.new(**options)
			return instance if instance.supported?
		end
		
		raise UnsupportedError, "No supported bridge found!"
	end
end