com.thoughtworks.selenium
Class HttpCommandProcessor

java.lang.Object
  extended by com.thoughtworks.selenium.HttpCommandProcessor
All Implemented Interfaces:
CommandProcessor

public class HttpCommandProcessor
extends java.lang.Object
implements CommandProcessor

Sends commands and retrieves results via HTTP.

Author:
Ben Griffiths, Jez Humble

Constructor Summary
HttpCommandProcessor(java.lang.String serverHost, int serverPort, java.lang.String browserStartCommand, java.lang.String browserURL)
          Specifies a server host/port, a command to launch the browser, and a starting URL for the browser.
HttpCommandProcessor(java.lang.String pathToServlet, java.lang.String browserStartCommand, java.lang.String browserURL)
          Specifies the URL to the CommandBridge servlet, a command to launch the browser, and a starting URL for the browser.
 
Method Summary
 java.lang.String doCommand(java.lang.String commandName, java.lang.String[] args)
          Send the specified remote command to the browser to be performed
 java.lang.String executeCommandOnServlet(java.lang.String command)
          Sends the specified command string to the bridge servlet
 boolean getBoolean(java.lang.String commandName, java.lang.String[] args)
           
 boolean[] getBooleanArray(java.lang.String commandName, java.lang.String[] args)
           
 java.lang.Number getNumber(java.lang.String commandName, java.lang.String[] args)
           
 java.lang.Number[] getNumberArray(java.lang.String commandName, java.lang.String[] args)
           
 java.lang.String getString(java.lang.String commandName, java.lang.String[] args)
           
 java.lang.String[] getStringArray(java.lang.String commandName, java.lang.String[] args)
           
 void start()
          Starts a new Selenium testing session
 void stop()
          Ends the current Selenium testing session (normally killing the browser)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpCommandProcessor

public HttpCommandProcessor(java.lang.String serverHost,
                            int serverPort,
                            java.lang.String browserStartCommand,
                            java.lang.String browserURL)
Specifies a server host/port, a command to launch the browser, and a starting URL for the browser.

Parameters:
serverHost - - the host name on which the Selenium Server resides
serverPort - - the port on which the Selenium Server is listening
browserStartCommand - - the command string used to launch the browser, e.g. "*firefox" or "c:\\program files\\internet explorer\\iexplore.exe"
browserURL - - the starting URL including just a domain name. We'll start the browser pointing at the Selenium resources on this URL, e.g. "http://www.google.com" would send the browser to "http://www.google.com/selenium-server/core/RemoteRunner.html"

HttpCommandProcessor

public HttpCommandProcessor(java.lang.String pathToServlet,
                            java.lang.String browserStartCommand,
                            java.lang.String browserURL)
Specifies the URL to the CommandBridge servlet, a command to launch the browser, and a starting URL for the browser.

Parameters:
pathToServlet - - the URL of the Selenium Server Driver, e.g. "http://localhost:4444/selenium-server/driver/" (don't forget the final slash!)
browserStartCommand - - the command string used to launch the browser, e.g. "*firefox" or "c:\\program files\\internet explorer\\iexplore.exe"
browserURL - - the starting URL including just a domain name. We'll start the browser pointing at the Selenium resources on this URL,
Method Detail

doCommand

public java.lang.String doCommand(java.lang.String commandName,
                                  java.lang.String[] args)
Description copied from interface: CommandProcessor
Send the specified remote command to the browser to be performed

Specified by:
doCommand in interface CommandProcessor
Parameters:
commandName - - the remote command verb
args - - the arguments to the remote command (depends on the verb)
Returns:
- the command result, defined by the remote JavaScript. "getX" style commands may return data from the browser; other "doX" style commands may just return "OK" or an error message.

executeCommandOnServlet

public java.lang.String executeCommandOnServlet(java.lang.String command)
Sends the specified command string to the bridge servlet


start

public void start()
Description copied from interface: CommandProcessor
Starts a new Selenium testing session

Specified by:
start in interface CommandProcessor

stop

public void stop()
Description copied from interface: CommandProcessor
Ends the current Selenium testing session (normally killing the browser)

Specified by:
stop in interface CommandProcessor

getString

public java.lang.String getString(java.lang.String commandName,
                                  java.lang.String[] args)
Specified by:
getString in interface CommandProcessor

getStringArray

public java.lang.String[] getStringArray(java.lang.String commandName,
                                         java.lang.String[] args)
Specified by:
getStringArray in interface CommandProcessor

getNumber

public java.lang.Number getNumber(java.lang.String commandName,
                                  java.lang.String[] args)
Specified by:
getNumber in interface CommandProcessor

getNumberArray

public java.lang.Number[] getNumberArray(java.lang.String commandName,
                                         java.lang.String[] args)
Specified by:
getNumberArray in interface CommandProcessor

getBoolean

public boolean getBoolean(java.lang.String commandName,
                          java.lang.String[] args)
Specified by:
getBoolean in interface CommandProcessor

getBooleanArray

public boolean[] getBooleanArray(java.lang.String commandName,
                                 java.lang.String[] args)
Specified by:
getBooleanArray in interface CommandProcessor


Copyright © 2006 null. All Rights Reserved.