Defines an abstract WebDriver client for Chromium-based web browsers. These classes should not be instantiated directly.
There are three primary classes exported by this module:
ServiceBuilder: configures the remote.DriverService that manages a WebDriver server child process.
Options: defines configuration options for each new Chromium session, such as which proxy to use, what extensions to install, or what command-line switches to use when starting the browser.
Driver: the WebDriver client; each new instance will control a unique browser session with a clean user profile (unless otherwise configured through the Options class).
let chrome = require('selenium-webdriver/chrome'); let {Builder} = require('selenium-webdriver');
let driver = new Builder() .forBrowser('chrome') .setChromeOptions(new chrome.Options()) .build();
Customizing the Chromium WebDriver Server
Subclasses of Driver are expected to provide a static getDefaultService method. By default, this method will be called every time a Driver instance is created to obtain the default driver service for that specific browser (e.g. Chrome or Chromium Edge). Subclasses are responsible for managing the lifetime of the default service.
You may also create a Driver with its own driver service. This is useful if you need to capture the server's log output for a specific session:
let chrome = require('selenium-webdriver/chrome');
let service = new chrome.ServiceBuilder()
.loggingTo('/my/log/file.txt')
.enableVerboseLogging()
.build();
let options = new chrome.Options();
// configure browser options ...
let driver = chrome.Driver.createSession(options, service);
- Source
Classes
Members
(inner, constant) Command :string
Custom command names supported by Chromium WebDriver.
- string
Name | Type | Description |
---|---|---|
LAUNCH_APP | string | |
GET_NETWORK_CONDITIONS | string | |
SET_NETWORK_CONDITIONS | string | |
DELETE_NETWORK_CONDITIONS | string | |
SEND_DEVTOOLS_COMMAND | string | |
SEND_AND_GET_DEVTOOLS_COMMAND | string | |
SET_PERMISSION | string | |
GET_CAST_SINKS | string | |
SET_CAST_SINK_TO_USE | string | |
START_CAST_DESKTOP_MIRRORING | string | |
START_CAST_TAB_MIRRORING | string | |
GET_CAST_ISSUE_MESSAGE | string | |
STOP_CASTING | string |
- Source
Methods
(inner) configureExecutor(executornon-null)
Configures the given executor with Chromium-specific commands.
Name | Type | Description |
---|---|---|
executor | http. | the executor to configure. |
- Source
(inner) createExecutor(urlnon-null, vendorPrefix) → (non-null) {command.Executor}
Creates a command executor with support for Chromium's custom commands.
Name | Type | Description |
---|---|---|
url | Promise.<string> | The server's URL. |
vendorPrefix |
- Source
The new command executor.
- Type:
- command.
Executor