org.openqa.selenium.phantomjs
Class PhantomJSDriverService.Builder

java.lang.Object
  extended by org.openqa.selenium.phantomjs.PhantomJSDriverService.Builder
Enclosing class:
PhantomJSDriverService

public static class PhantomJSDriverService.Builder
extends java.lang.Object

Builder used to configure new PhantomJSDriverService instances.


Constructor Summary
PhantomJSDriverService.Builder()
           
 
Method Summary
 PhantomJSDriverService build()
          Creates a new service.
 PhantomJSDriverService.Builder usingAnyFreePort()
          Configures the service to listen on any available port.
 PhantomJSDriverService.Builder usingCommandLineArguments(java.lang.String[] commandLineArguments)
          Configures the service to pass additional command line arguments to the PhantomJS executable.
 PhantomJSDriverService.Builder usingGhostDriver(java.io.File file)
          Sets which GhostDriver the builder will use.
 PhantomJSDriverService.Builder usingPhantomJSExecutable(java.io.File file)
          Sets which PhantomJS executable the builder will use.
 PhantomJSDriverService.Builder usingPort(int port)
          Sets which port the service should listen on.
 PhantomJSDriverService.Builder withEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
          Defines the environment for the service.
 PhantomJSDriverService.Builder withLogFile(java.io.File logFile)
          Configures the service to write log to the given file.
 PhantomJSDriverService.Builder withProxy(org.openqa.selenium.Proxy proxy)
          Configures the service to use a specific Proxy configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhantomJSDriverService.Builder

public PhantomJSDriverService.Builder()
Method Detail

usingPhantomJSExecutable

public PhantomJSDriverService.Builder usingPhantomJSExecutable(java.io.File file)
Sets which PhantomJS executable the builder will use.

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

usingGhostDriver

public PhantomJSDriverService.Builder usingGhostDriver(java.io.File file)
Sets which GhostDriver the builder will use.

Parameters:
file - The GhostDriver's main.js to use.
Returns:
A self reference.

usingPort

public PhantomJSDriverService.Builder usingPort(int port)
Sets which port the service should listen 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 PhantomJSDriverService.Builder usingAnyFreePort()
Configures the service to listen on any available port.

Returns:
A self reference.

withEnvironment

public PhantomJSDriverService.Builder withEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
Defines the environment for the service. These settings will be inherited by every browser session launched by the service.

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

withLogFile

public PhantomJSDriverService.Builder withLogFile(java.io.File logFile)
Configures the service to write log to the given file.

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

withProxy

public PhantomJSDriverService.Builder withProxy(org.openqa.selenium.Proxy proxy)
Configures the service to use a specific Proxy configuration.

NOTE: Usually the proxy configuration is passed to the Remote WebDriver via WireProtocol Capabilities. PhantomJS doesn't yet support protocol configuration at runtime: it requires it to be defined on launch.

Parameters:
proxy - The Proxy configuration from the DesiredCapabilities
Returns:
A self reference.

usingCommandLineArguments

public PhantomJSDriverService.Builder usingCommandLineArguments(java.lang.String[] commandLineArguments)
Configures the service to pass additional command line arguments to the PhantomJS executable.

Parameters:
commandLineArguments - list of command line arguments, e.g. "--ignore-ssl-errors=yes"
Returns:
A self reference.

build

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

Returns:
The new service object.