Selenium – how to start the test in parallel with selenium grid 2

gridinstallationselenium

I am new at this.
What I want to do is start the test cases on multiple browsers at the same time.
This is the xml file that I use to run:

<suite name="Selenium Grid with webdriver" verbose="3" parallel="tests" thread-count="2">
    <test name ="Selenium Grid demo">
        <parameter name ="browser" value = "iexplore"/>
        <classes>
            <class name="test.GridWithWebdriver"/>

        </classes>
    </test>

    <test name ="Selenium Grid demo2">
        <parameter name ="browser" value = "firefox"/>
        <classes>
            <class name="test.GridWithWebdriver"/>
        </classes>
    </test>

</suite>

The problem is the second test which runs on firefox only run after the one runs on IE finishes.
I tried to run the hub with max instances = 5 by this command:

java -jar selenium-server-standalone-2.24.1.jar -role hub -maxInstances=5

But then I still see the warning max instance not specified, using default = 1
So maybe this is why it's not running in parallel?
Also if I want to start the same test case on 3 IE browsers how can I do it?
Please help me with the setup.
Thank you

Best Answer

You have to register one more node to the Selenium grid HUB. Let's have an example :

/*These two will only start the hub*/
start java -jar selenium-server-standalone-2.25.0.jar -role hub
start java -jar selenium-server-standalone-2.25.0.jar -role node 

/*Register node to port 5556*/
java -jar selenium-server-standalone-2.25.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5556 -browser browserName=firefox

/*Register node to port 5556*/
java -jar selenium-server-standalone-2.25.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5557 -browser browserName=firefox

Regarding IE, have a look on this example : GRID2 configuration - in parallel

EDIT : Better solution is to do what is explained here : Multiple instances. The idea is to open the node with following parameters :

-maxSession x -browser browserName=firefox,maxInstances=x

In your case, instead of x, put 5.

Related Topic