Few months back, I was trying to run selenium script with Selenium RC Java. Initially I faced few issues to configure the classpath settings. We need to pass the proxy details, if the net connection is based on proxy. I created three batch scripts to run the server and client. You should have latest java version. For more info about Selenium RC, check out Selenium RC documentation .
Selenium Server to start with proxy
Here user can set the username and password for proxy connection. Checkout java options to do that.
REM ******************************************** REM To Run Selenium server REM Author: Palani Selvam REM ******************************************** REM Selenium server path set SeleniumServer=D:\Selenium_trial\tool\selenium-remote-control-0.9.2\selenium-server-0.9.2 REM to run the Selenium server with proxy d: cd %SeleniumServer% java -Dhttp.proxyHost=proxy.mycompany.com -Dhttp.proxyPort=8080 -jar selenium-server.jar
Selenium Server to start without proxy
It will be useful for non-proxy connection.
REM ******************************************** REM To Run Selenium server REM Author: Palani Selvam REM ******************************************** REM Selenium server path set SeleniumServer=D:\Selenium_trial\tool\selenium-remote-control-0.9.2\selenium-server-0.9.2 REM to run the Selenium server without proxy d: cd %SeleniumServer% java -jar selenium-server.jar
To run the Selenium client
Below I have given the batch script to run the GetAllStockQuotes.java. Source code is available at Indian Stock Quotes through Selenium
REM ******************************************** REM To Run Selenium client (Java). Also sets path and classpath REM Author: Palani Selvam REM ******************************************** REM to set class path and path env variables to run selenium set javaClientPath=D:\Selenium_trial\tool\selenium-remote-control-1.0.1\selenium-java-client-driver-1.0.1 Set javaClientJars=%javaClientPath%\selenium-java-client-driver.jar REM JUnit jar Set jUnitJars=D:\java\JUnit\junit46.jar REM Selenium Script (Java) dir path set Stockspath=D:\Selenium_trial REM Setting classpath set classpath=%classpath%;%javaClientJars%;%jUnitJars%;%Stockspath%\classes; d: cd %Stockspath% REM Compiling test scripts Selenium-java code javac -d classes GetAllStockQuotes.java REM Running the test scripts java junit.textui.TestRunner com.palani.tests.GetAllStockQuotes
For more details of Selenium tools configuration, you can refer 5 Minute Guide To Selenium IDE and Selenium Remote Control (Java) Test Tools