Module: selenium-webdriver/remote
View Source

# class SeleniumServer

    DriverService
      └ SeleniumServer

Manages the life and death of the standalone Selenium server.

### new SeleniumServer(jar, opt_options)

Parameters

jar`string`

  Path to the Selenium server jar.

opt_options`{args: (Array<string>|webdriver.promise.Promise), env: (Object<string, string>|undefined), jvmArgs: (Array<string>|webdriver.promise.Promise|undefined), loopback: (boolean|undefined), port: (number|webdriver.promise.Promise), stdio: (string|Array<?(string|number|Stream)>|undefined)}=`

  Configuration options for the server.

Throws

`Error`

  If the path to the Selenium jar is not specified or if an invalid port is specified.

## Instance Methods

### address()code »

Defined by: DriverService

Returns

`webdriver.promise.Promise`

  A promise that resolves to the server's address.

Throws

`Error`

  If the server has not been started.

### isRunning()code »

Returns whether the underlying process is still running. This does not take into account whether the process is in the process of shutting down.

Defined by: DriverService

Returns

`boolean`

  Whether the underlying service process is running.

### kill()code »

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()`.

Defined by: DriverService

Returns

`webdriver.promise.Promise`

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

### start(opt_timeoutMs)code »

Starts the server if it is not already running.

Defined by: DriverService

Parameters

opt_timeoutMs`number=`

  How long to wait, in milliseconds, for the server to start accepting requests. Defaults to 30 seconds.

Returns

`webdriver.promise.Promise`

  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.

### stop()code »

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

Defined by: DriverService

Returns

`webdriver.promise.Promise`

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

## Type Definitions

SeleniumServer.Options`{args: (Array<string>|webdriver.promise.Promise), env: (Object<string, string>|undefined), jvmArgs: (Array<string>|webdriver.promise.Promise|undefined), loopback: (boolean|undefined), port: (number|webdriver.promise.Promise), stdio: (string|Array<?(string|number|Stream)>|undefined)}`

  Options for the Selenium server:

  - `loopback` - Whether the server should only be accessed on this host's loopback address.
  - `port` - The port to start the server on (must be > 0). If the port is provided as a promise, the service will wait for the promise to resolve before starting.
  - `args` - The arguments to pass to the service. If a promise is provided, the service will wait for it to resolve before starting.
  - `jvmArgs` - The arguments to pass to the JVM. If a promise is provided, the service will wait for it to resolve before starting.
  - `env` - The environment variables that should be visible to the server process. Defaults to inheriting the current process's environment.
  - `stdio` - IO configuration for the spawned server process. For more information, refer to the documentation of `child_process.spawn`.