DriverService. Builder

Creates DriverService objects that manage a WebDriver server in a child process.

Constructor

new Builder(exe)

Parameters:
NameTypeDescription
exestring

Path to the executable to use. This executable must accept the --port flag for defining the port to start the server on.

Throws:

If the provided executable path does not exist.

Type
Error

Methods

addArguments(…var_args) → (non-null) {THIS}

Define additional command line arguments to use when starting the server.

This:
  • {THIS}
Parameters:
NameTypeAttributesDescription
var_argsCommandLineFlag<repeatable>

The arguments to include.

Returns:

A self reference.

Type: 
THIS

build() → (non-null) {DriverService}

Creates a new DriverService using this instance's current configuration.

Returns:

A new driver service.

Type: 
DriverService

setEnvironment(env) → (non-null) {DriverService.Builder}

Defines the environment to start the server under. This setting will be inherited by every browser session started by the server. By default, the server will inherit the enviroment of the current process.

Parameters:
NameTypeDescription
envMap.<string, string> | Object.<string, string> | null

The desired environment to use, or null if the server should inherit the current environment.

Returns:

A self reference.

Type: 
DriverService.Builder

setHostname(hostname) → (non-null) {DriverService.Builder}

Sets the host name to access the server on. If specified, the loopback setting will be ignored.

Parameters:
NameTypeDescription
hostnamestring
Returns:

A self reference.

Type: 
DriverService.Builder

setLoopback(loopback) → (non-null) {DriverService.Builder}

Sets whether the service should be accessed at this host's loopback address.

Parameters:
NameTypeDescription
loopbackboolean
Returns:

A self reference.

Type: 
DriverService.Builder

setPath(basePathnullable) → (non-null) {DriverService.Builder}

Sets the base path for WebDriver REST commands (e.g. "/wd/hub"). By default, the driver will accept commands relative to "/".

Parameters:
NameTypeAttributesDescription
basePathstring<nullable>

The base path to use, or null to use the default.

Returns:

A self reference.

Type: 
DriverService.Builder

setPort(port) → (non-null) {DriverService.Builder}

Sets the port to start the server on.

Parameters:
NameTypeDescription
portnumber

The port to use, or 0 for any free port.

Throws:

If an invalid port is specified.

Type
Error
Returns:

A self reference.

Type: 
DriverService.Builder

setStdio(config) → (non-null) {DriverService.Builder}

IO configuration for the spawned server process. For more information, refer to the documentation of child_process.spawn.

Parameters:
NameTypeDescription
configStdIoOptions

The desired IO configuration.

Returns:

A self reference.

Type: 
DriverService.Builder