1
votes

I was trying to run test concurrently with two browsers firefox and chrome. I had opened three command line windows with following commands 1. java -jar selenium-server-standalone-2.33.0.jar -role

  1. java -jar selenium-server-standalone-2.33.0.jar -role webdriver -hub localhost:4444/grid/register -browser browserName="chrome", version=8.0, platform=WINDOWS -Dwebdriver.chrome.driver=f:\chromedriver.exe

  2. java -jar selenium-server-standalone-2.33.0.jar -role webdriver -hub localhost:4444/grid/register -port 5566

I had following code in GridTest.java file

    public static String browser;
    public static void setUp() throws MalformedURLException //throws MalformedURLException
    {
//      if (browser.equalsIgnoreCase("firefox"))
//      {
        DesiredCapabilities capability1=DesiredCapabilities.firefox();
        capability1= DesiredCapabilities.firefox();
        capability1.setBrowserName("firefox");
        capability1.setPlatform(Platform.WIN8);
        driver=new RemoteWebDriver(new URL(nodeURL), capability1);
//      }
//      
//      if (browser.equalsIgnoreCase("chrome"))
//      {
        capability1=DesiredCapabilities.chrome();
        capability1.setBrowserName("chrome");
        capability1.setPlatform(Platform.WIN8);
        driver=new RemoteWebDriver(new URL(nodeURL), capability1);
//      }
    }

Do I have to open another command line window if I have to run test in IE? Can test be run concurrently with testng.xml? Please provide the solution

2

2 Answers

1
votes

Had the same issue, solved by Updating the "Chromedriver.exe".

Note: Even if you update to the latest chromedriver.exe, make sure that your project points to the latest one. (the project could be pointing to old diver)

0
votes

crazvink, 1. you don't have to open a new command line window for each browser you can just concat the browser type in one NODE process like this:

java -jar selenium-server-standalone-2.33.0.jar -role node -browser browserName=firefox,version=3.6,maxInstances=5,platform=WINDOWS -browser browserName=chrome,maxInstances=5,platform=WINDOWS -Dwebdriver.chrome.driver=f:\chromedriver.exe

  1. you should only run another command line window for hub.

  2. of course you can do it, but then you need to manipulate ports (like you did) which is unnecessary, in such a simple case.

yes, running in parallel is very simple, but you need to make sure the webdrivers are instantiated in the test methods themselves, using dataprovider for each different browser/platform type. and then just set parallel=methods in the testing.xml (testNg?). *this is an optional solution, it can be dome in many more ways (like class factory, and parallel=instances).

note this : running in parallel on the same display might be problematic since browsers focus can be interfered between tests :(.

anyway maybe you will find this helpful too: http://www.ravellosystems.com/blog/build-effective-web-ui-testing-lab/

for building your testing grid lab without the hassle and scaling it as you go.

[Disclosure : i work for Ravello.]