seleniumselenium-webdriverselenium-gridremotewebdriverselenium-hub

Not able to execute more that 5 instances of browser in a node using Selenium Grid


When I execute more than 5 tests in parallel using TestNG via Selenium Grid, only 5 are getting executed simultaneously. The rest are getting queued. I have configured my node so that it supports 7 instances of Chrome. Why are the 2 remaining instances not getting utilized?

Here is the node screenshot from Grid Console:

enter image description here

Node Configuration Screenshot:

Node configuration

Node Start Code:

java -jar selenium-server-standalone-3.8.1.jar -role node  -hub http://localhost:4444/grid/register -port 5556 -nodeConfig nodeConfig.json

Node Config JSON:

{
  "capabilities": [

    {
      "browserName": "chrome",
      "platform": "WIN10",
      "maxInstances": 7
    }

  ],
  "hub": "http://selenium-hub-host:4444"
}

TestNG XML (I am using parallel to run all the 7 tests in parallel):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">


<suite name="myTestSuit" parallel="tests" thread-count="10">


    <test name="myTest1">

        <parameter name="browser" value="Chrome"></parameter>

        <classes>

            <class name="testClass1"></class>
            <class name="testClass2"></class>
            <class name="testClass3"></class>

        </classes>

    </test>


    <test name="myTest2">

        <parameter name="browser" value="Chrome"></parameter>

        <classes>

            <class name="testClass1"></class>
            <class name="testClass2"></class>
            <class name="testClass3"></class>

        </classes>

    </test>


    <test name="myTest3">

        <parameter name="browser" value="Chrome"></parameter>

        <classes>

            <class name="testClass1"></class>
            <class name="testClass2"></class>
            <class name="testClass3"></class>

        </classes>

    </test>


    <test name="myTest4">

        <parameter name="browser" value="Chrome"></parameter>

        <classes>

            <class name="testClass1"></class>
            <class name="testClass2"></class>
            <class name="testClass3"></class>

        </classes>

    </test>


    <test name="myTest5">

        <parameter name="browser" value="Chrome"></parameter>

        <classes>

            <class name="testClass1"></class>
            <class name="testClass2"></class>
            <class name="testClass3"></class>

        </classes>

    </test>



    <test name="myTest6">

        <parameter name="browser" value="Chrome"></parameter>

        <classes>

            <class name="testClass1"></class>
            <class name="testClass2"></class>
            <class name="testClass3"></class>

        </classes>

    </test>


    <test name="myTest7">

        <parameter name="browser" value="Chrome"></parameter>

        <classes>

            <class name="testClass1"></class>
            <class name="testClass2"></class>
            <class name="testClass3"></class>

        </classes>

    </test>



</suite>

(I also tried creating two nodes in my system. Each supports 5 Chromes so total I have 10 Chrome instances. In this case, also only 5 of the total available instances are getting utilized).


Solution

  • I was able to fix this by applying both the solutions of @murali selenium and @Ratmir Asanov.

    1. First in TestNG XML, set thread-count="10" (Defaul value will be 5)
    2. Now, inside Node config JSON, set "maxSession": 10 (By default only 5 sessions will be allowed in a 'MACHINE')