Question

After succesfully setting up selenium webdriver with testng, I want to move to Selenium grid 2. I have downlaoded the selenium-server-standalone-2.35.0.jar file, however when runnning this :

java –jar selenium-server-standalone-2.30.0.jar –role hub

I got this error :

Error: Could not find or load main class ûjar

I have set my env variables as follow :

CLASSPATH :

C:\Selenium grid\selenium-server-standalone-2.35.0.jar;C:\selenium-2.35.0\selenium-java-2.35.0.jar

PATH :

C:\Program Files\Java\jdk1.7.0_40\bin;C:\Selenium grid\

Please could you help me setting up grid 2?

Was it helpful?

Solution

Here is my batch script for running hub and node. Script is executed where are placed selenium jars.

As you see variable HERE should point to Java folder

 set HERE=%CD%
set CHROME_VERSION=chromedriver_win_23.0.1240.0
set CHROME_DRIVER_LOC=%HERE%\%CHROME_VERSION%\chromedriver.exe
set JAVA_HOME=%HERE%\jdk1.7.0_10
set PATH=%JAVA_HOME%\jre\bin;%JAVA_HOME%\bin;%HERE%\%CHROME_VERSION%\;%PATH%
set SELENIUM_VERSION=2.28.0

set HUB_URL=http://192.198.1.102:4444/grid/register

start java -jar selenium-server-standalone-%SELENIUM_VERSION%.jar -role hub
start java -jar selenium-server-standalone-%SELENIUM_VERSION%.jar -role node 
-Dwebdriver.chrome.driver= %CHROME_DRIVER_LOC% -hub %HUB_URL% -port 5556   -nodeConfig webconfig.txt

EDIT for comment:

So here is folder tree to clearly understand what is happening

 -|
  |-selenium-server-standalone-2.28.0.jar
  |-chromedriver_win_23.0.1240.0
    |-chromedriver.exe
  |-jdk1.7.0_10
    |-jre
    |-bin etc..
  |-thisScript.bat

This script should be totally independent from PATH setting mentioned in your question. PATH variable overrides system PATH variable only for that script - personally you can try different configuration and paths but I was only using above setup and it worked as intended.

I also found tutorial what I had been using when setting up my selenium grid enviroment: http://rationaleemotions.wordpress.com/2012/01/23/setting-up-grid2-and-working-with-it/

OTHER TIPS

Download the latest version of selenium, say 2.39.0 from the seleniumHQ.org site.

Place it in C:\ drive. Goto the environment variables and add java -jar selenium-server-standalone-2.39.0.jar to the classpath

Open Command prompt and then navigate to the C:\ drive where you placed the jar and type java -jar selenium-server-standalone-2.39.0.jar -role hub

Press enter

After this, you would get something like this

C:>java -jar selenium-server-standalone-2.39.0.jar -role hub Feb 05, 2014 12:51:15 PM org.openqa.grid.selenium.GridLauncher main INFO: Launching a selenium grid server 2014-02-05 12:51:17.517:INFO:osjs.Server:jetty-7.x.y-SNAPSHOT 2014-02-05 12:51:17.554:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContextHandler{/,null} 2014-02-05 12:51:17.564:INFO:osjs.AbstractConnector:Started SocketConnector@0.0.0.0:4444

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top