org.openqa.selenium.remote.service
Class DriverService

java.lang.Object
  extended by org.openqa.selenium.remote.service.DriverService

public class DriverService
extends Object

Manages the life and death of a native executable driver server. It is expected that the driver server implements the WebDriver Wire Protocol. In particular, it should implement /status command that is used to check if the server is alive. In addition to this, it is supposed that the driver server implements /shutdown hook that is used to stop the server.


Constructor Summary
protected DriverService(File executable, int port, com.google.common.collect.ImmutableList<String> args, com.google.common.collect.ImmutableMap<String,String> environment)
           
 
Method Summary
protected static void checkExecutable(File exe)
           
protected static File findExecutable(String exeName, String exeProperty, String exeDocs, String exeDownload)
           
 URL getUrl()
           
 boolean isRunning()
          Checks whether the driver child process is currently running.
 void start()
          Starts this service if it is not already running.
 void stop()
          Stops this service is it is currently running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DriverService

protected DriverService(File executable,
                        int port,
                        com.google.common.collect.ImmutableList<String> args,
                        com.google.common.collect.ImmutableMap<String,String> environment)
                 throws IOException
Parameters:
executable - The driver executable.
port - Which port to start the driver server on.
args - The arguments to the launched server.
environment - The environment for the launched server.
Throws:
IOException - If an I/O error occurs.
Method Detail

getUrl

public URL getUrl()
Returns:
The base URL for the managed driver server.

findExecutable

protected static File findExecutable(String exeName,
                                     String exeProperty,
                                     String exeDocs,
                                     String exeDownload)
Parameters:
exeName - Name of the executable file to look for in PATH
exeProperty - Name of a system property that specifies the path to the executable file
exeDocs - The link to the driver documentation page
exeDownload - The link to the driver download page
Returns:
The driver executable as a File object
Throws:
IllegalStateException - If the executable not found or cannot be executed

checkExecutable

protected static void checkExecutable(File exe)

isRunning

public boolean isRunning()
Checks whether the driver child process is currently running.

Returns:
Whether the driver child process is still running.

start

public void start()
           throws IOException
Starts this service if it is not already running. This method will block until the server has been fully started and is ready to handle commands.

Throws:
IOException - If an error occurs while spawning the child process.
See Also:
stop()

stop

public void stop()
Stops this service is it is currently running. This method will attempt to block until the server has been fully shutdown.

See Also:
start()


Copyright © 2012. All Rights Reserved.