# Class DriverService

code »

Manages the life and death of a native executable WebDriver server.

It is expected that the driver server implements the WebDriver Wire Protocol. Furthermore, the managed server should support multiple concurrent sessions, so that this class may be reused for multiple clients.

## Constructor

DriverService ( executable, options )

Parameters
executable: `string` Path to the executable to run. options: `!ServiceOptions` Configuration options for the service.

Show:Public Protected Private

## Instance Methods

code »address ( ) ⇒ `!webdriver.promise.Promise.<string>`

Returns
A promise that resolves to the server's address.
Throws
`Error` If the server has not been started.

code »isRunning ( ) ⇒ `boolean`

Returns
Whether the underlying service process is running.

code »kill ( ) ⇒ `!webdriver.promise.Promise`

Stops the service if it is not currently running. This function will kill the server immediately. To synchronize with the active control flow, use `#stop()`.

Returns
A promise that will be resolved when the server has been stopped.

code »start ( opt_timeoutMs ) ⇒ `!webdriver.promise.Promise.<string>`

Starts the server if it is not already running.

Parameters
opt_timeoutMs: `number=` How long to wait, in milliseconds, for the server to start accepting requests. Defaults to 30 seconds.
Returns
A promise that will resolve to the server's base URL when it has started accepting requests. If the timeout expires before the server has started, the promise will be rejected.

code »stop ( ) ⇒ `!webdriver.promise.Promise`

Schedules a task in the current control flow to stop the server if it is currently running.

Returns
A promise that will be resolved when the server has been stopped.

## Instance Properties

code »address_ : `webdriver.promise.Promise.<string>`

Promise that resolves to the server's address or null if the server has not been started.

code »args_ : `!(Array.<string>|webdriver.promise.Promise)`
code »env_ : `!Object.<string, string>`
code »executable_ : `string`
code »path_ : `string`
code »port_ : `(number|!webdriver.promise.Promise.<number>)`
code »process_ : `child_process.ChildProcess`
code »shutdownHook_ : `webdriver.promise.Promise`

Promise that tracks the status of shutting down the server, or null if the server is not currently shutting down.

code »stdio_ : `(string|!Array)`

## Static Properties

code »DriverService.DEFAULT_START_TIMEOUT_MS : `number`

The default amount of time, in milliseconds, to wait for the server to start.