org.openqa.selenium.remote.service
Class DriverService.Builder

java.lang.Object
  extended by org.openqa.selenium.remote.service.DriverService.Builder
Enclosing class:
DriverService

public abstract static class DriverService.Builder
extends Object

Builder used to configure new DriverService instances.


Field Summary
protected  com.google.common.collect.ImmutableMap<String,String> environment
           
protected  File exe
           
protected  File logFile
           
protected  int port
           
 
Constructor Summary
DriverService.Builder()
           
 
Method Summary
 DriverService build()
          Creates a new service to manage the driver server.
protected abstract  DriverService buildDriverService()
          Used by a template method build() to perform the driver specific checks and instantiate the specific service object.
 DriverService.Builder usingAnyFreePort()
          Configures the driver server to start on any available port.
 DriverService.Builder usingDriverExecutable(File file)
          Sets which driver executable the builder will use.
 DriverService.Builder usingPort(int port)
          Sets which port the driver server should be started on.
 DriverService.Builder withEnvironment(Map<String,String> environment)
          Defines the environment for the launched driver server.
 DriverService.Builder withLogFile(File logFile)
          Configures the driver server to write log to the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

port

protected int port

exe

protected File exe

environment

protected com.google.common.collect.ImmutableMap<String,String> environment

logFile

protected File logFile
Constructor Detail

DriverService.Builder

public DriverService.Builder()
Method Detail

usingDriverExecutable

public DriverService.Builder usingDriverExecutable(File file)
Sets which driver executable the builder will use.

Parameters:
file - The executable to use.
Returns:
A self reference.

usingPort

public DriverService.Builder usingPort(int port)
Sets which port the driver server should be started on. A value of 0 indicates that any free port may be used.

Parameters:
port - The port to use; must be non-negative.
Returns:
A self reference.

usingAnyFreePort

public DriverService.Builder usingAnyFreePort()
Configures the driver server to start on any available port.

Returns:
A self reference.

withEnvironment

@Beta
public DriverService.Builder withEnvironment(Map<String,String> environment)
Defines the environment for the launched driver server. These settings will be inherited by every browser session launched by the server.

Parameters:
environment - A map of the environment variables to launch the server with.
Returns:
A self reference.

withLogFile

public DriverService.Builder withLogFile(File logFile)
Configures the driver server to write log to the given file.

Parameters:
logFile - A file to write log to.
Returns:
A self reference.

build

public DriverService build()
Creates a new service to manage the driver server. Before creating a new service, the builder will find a port for the server to listen to.

Returns:
The new service object.
See Also:
buildDriverService()

buildDriverService

protected abstract DriverService buildDriverService()
                                             throws IOException
Used by a template method build() to perform the driver specific checks and instantiate the specific service object.

Returns:
The new service object.
Throws:
IOException - If an I/O error occurs.


Copyright © 2012. All Rights Reserved.