class Chrome
A bridge to the Chrome browser using chromedriver
.
begin
bridge = Async::WebDriver::Bridge::Chrome.start
client = Async::WebDriver::Client.open(bridge.endpoint)
ensure
bridge&.close
end
Nested
Definitions
def version
Signature
-
returns
String
The version of the
chromedriver
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 Chrome 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 Chrome browser.
Implementation
def default_capabilities(headless: self.headless?)
{
alwaysMatch: {
browserName: "chrome",
"goog:chromeOptions": {
args: [headless ? "--headless" : nil].compact,
},
webSocketUrl: true,
},
}
end