selenium-webdriver/chromium

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:

  1. ServiceBuilder: configures the remote.DriverService that manages a WebDriver server child process.

  2. 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.

  3. 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);

Classes

Driver
Extensions
Options
ServiceBuilder

Members

(inner, constant) Command :string

Custom command names supported by Chromium WebDriver.

Type:
  • string
Properties
NameTypeDescription
LAUNCH_APPstring
GET_NETWORK_CONDITIONSstring
SET_NETWORK_CONDITIONSstring
DELETE_NETWORK_CONDITIONSstring
SEND_DEVTOOLS_COMMANDstring
SEND_AND_GET_DEVTOOLS_COMMANDstring
SET_PERMISSIONstring
GET_CAST_SINKSstring
SET_CAST_SINK_TO_USEstring
START_CAST_DESKTOP_MIRRORINGstring
START_CAST_TAB_MIRRORINGstring
GET_CAST_ISSUE_MESSAGEstring
STOP_CASTINGstring

Methods

(inner) configureExecutor(executornon-null)

Configures the given executor with Chromium-specific commands.

Parameters:
NameTypeDescription
executorhttp.Executor

the executor to configure.

(inner) createExecutor(urlnon-null, vendorPrefix) → (non-null) {command.Executor}

Creates a command executor with support for Chromium's custom commands.

Parameters:
NameTypeDescription
urlPromise.<string>

The server's URL.

vendorPrefix
Returns:

The new command executor.

Type: 
command.Executor