class ServiceBuilder

Creates selenium-webdriver/remote.DriverService instances that manage a ChromeDriver server in a child process.

new ServiceBuilder(opt_exe)

Parameters
opt_exestring=

Path to the server executable to use. If omitted, the builder will attempt to locate the chromedriver on the current PATH.

Throws
Error

If provided executable does not exist, or the chromedriver cannot be found on the PATH.

Instance Methods

build()code »

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

Returns
DriverService

A new driver service using this instance's current configuration.

Throws
Error

If the driver exectuable was not specified and a default could not be found on the current PATH.


enableVerboseLogging()code »

Enables verbose logging.

Returns
ServiceBuilder

A self reference.


loggingTo(path)code »

Sets the path of the log file the driver should log to. If a log file is not specified, the driver will log to stderr.

Parameters
pathstring

Path of the log file to use.

Returns
ServiceBuilder

A self reference.


setAdbPort(port)code »

Sets which port adb is listening to. The ChromeDriver will connect to adb if an Android session is requested, but adb must be started beforehand.

Parameters
portnumber

Which port adb is running on.

Returns
ServiceBuilder

A self reference.


setNumHttpThreads(n)code »

Sets the number of threads the driver should use to manage HTTP requests. By default, the driver will use 4 threads.

Parameters
nnumber

The number of threads to use.

Returns
ServiceBuilder

A self reference.


setStdio(config)code »

Defines the stdio configuration for the driver service. See child_process.spawn for more information.

Parameters
config(string|Array<?(string|number|Stream)>)

The configuration to use.

Returns
ServiceBuilder

A self reference.


setUrlBasePath(path)code »

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

Parameters
pathstring

The base path to use.

Returns
ServiceBuilder

A self reference.


usingPort(port)code »

Sets the port to start the ChromeDriver on.

Parameters
portnumber

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

Returns
ServiceBuilder

A self reference.

Throws
Error

If the port is invalid.


withEnvironment(env)code »

Defines the environment to start the server under. This settings will be inherited by every browser session started by the server.

Parameters
envObject<string, string>

The environment to use.

Returns
ServiceBuilder

A self reference.