public class HttpCommandProcessor extends Object implements CommandProcessor
| Constructor and Description |
|---|
HttpCommandProcessor(String serverHost,
int serverPort,
String browserStartCommand,
String browserURL)
Specifies a server host/port, a command to launch the browser, and a starting URL for the browser.
|
HttpCommandProcessor(String pathToServlet,
String browserStartCommand,
String browserURL)
Specifies the URL to the CommandBridge servlet, a command to launch the browser, and a starting URL for the browser.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeResources(HttpURLConnection conn,
Writer wr,
Reader rdr) |
String |
doCommand(String commandName,
String[] args)
Send the specified remote command to the browser to be performed
|
String |
executeCommandOnServlet(String command)
Sends the specified command string to the bridge servlet
|
boolean |
getBoolean(String commandName,
String[] args) |
boolean[] |
getBooleanArray(String commandName,
String[] args) |
protected String |
getCommandResponseAsString(String command) |
protected HttpURLConnection |
getHttpUrlConnection(URL urlForServlet) |
protected Reader |
getInputStreamReader(HttpURLConnection conn) |
Number |
getNumber(String commandName,
String[] args) |
Number[] |
getNumberArray(String commandName,
String[] args) |
protected Writer |
getOutputStreamWriter(HttpURLConnection conn) |
String |
getRemoteControlServerLocation()
The URL that the RemoteControl instance is allegedly running on
|
protected int |
getResponseCode(HttpURLConnection conn) |
String |
getString(String commandName,
String[] args) |
String[] |
getStringArray(String commandName,
String[] args) |
boolean |
hasSessionInProgress() |
static String[] |
parseCSV(String input)
Convert backslash-escaped comma-delimited string into String array.
|
void |
setExtensionJs(String extensionJs)
This should be invoked before start().
|
protected void |
setSessionInProgress(String result) |
void |
start()
Starts a new Selenium testing session
|
void |
start(Object optionsObject)
Wraps the version of start() that takes a String parameter, sending it
the result of calling toString() on optionsObject, which will likely be
a BrowserConfigurationOptions instance.
|
void |
start(String optionsString)
Starts a new Selenium testing session with a String, representing a configuration
|
void |
stop()
Ends the current Selenium testing session (normally killing the browser)
|
protected String |
throwAssertionFailureExceptionOrError(String message) |
public HttpCommandProcessor(String serverHost, int serverPort, String browserStartCommand, String browserURL)
serverHost - - the host name on which the Selenium Server residesserverPort - - the port on which the Selenium Server is listeningbrowserStartCommand - - 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,extensionJs - - extension Javascript for this session
e.g. "http://www.google.com" would send the browser to "http://www.google.com/selenium-server/core/RemoteRunner.html"public HttpCommandProcessor(String pathToServlet, String browserStartCommand, String browserURL)
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,extensionJs - - extension Javascript for this sessionpublic String getRemoteControlServerLocation()
CommandProcessorgetRemoteControlServerLocation in interface CommandProcessorpublic String doCommand(String commandName, String[] args)
CommandProcessordoCommand in interface CommandProcessorcommandName - - the remote command verbargs - - the arguments to the remote command (depends on the verb)protected String throwAssertionFailureExceptionOrError(String message)
public String executeCommandOnServlet(String command)
protected HttpURLConnection getHttpUrlConnection(URL urlForServlet) throws IOException
IOExceptionprotected Writer getOutputStreamWriter(HttpURLConnection conn) throws IOException
IOExceptionprotected Reader getInputStreamReader(HttpURLConnection conn) throws IOException
IOExceptionprotected int getResponseCode(HttpURLConnection conn) throws IOException
IOExceptionprotected String getCommandResponseAsString(String command) throws IOException
IOExceptionprotected void closeResources(HttpURLConnection conn, Writer wr, Reader rdr)
public void setExtensionJs(String extensionJs)
setExtensionJs in interface CommandProcessorextensionJs - the extra extension Javascript to include in this
browser session.public void start()
CommandProcessorstart in interface CommandProcessorpublic void start(String optionsString)
CommandProcessorstart in interface CommandProcessorpublic void start(Object optionsObject)
start in interface CommandProcessoroptionsObject - protected void setSessionInProgress(String result)
public void stop()
CommandProcessorstop in interface CommandProcessorpublic boolean hasSessionInProgress()
public String getString(String commandName, String[] args)
getString in interface CommandProcessorpublic String[] getStringArray(String commandName, String[] args)
getStringArray in interface CommandProcessorpublic static String[] parseCSV(String input)
input - the unparsed string, e.g. "veni\, vidi\, vici,c:\\foo\\bar,c:\\I came\, I \\saw\\\, I conquered"public Number getNumber(String commandName, String[] args)
getNumber in interface CommandProcessorpublic Number[] getNumberArray(String commandName, String[] args)
getNumberArray in interface CommandProcessorpublic boolean getBoolean(String commandName, String[] args)
getBoolean in interface CommandProcessorpublic boolean[] getBooleanArray(String commandName, String[] args)
getBooleanArray in interface CommandProcessorCopyright © 2012. All Rights Reserved.