2
votes

How to run multiple browsers(Firefox, IE, Chrome) in a single Selenium webdriver Node.

Tried the below command with 2 browsers(Firefox,IE or Firefox,chrome) and it was successful,

java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.ie.driver="C:\IEDriverServer.exe" -role node -hub http://x.x.x.x:5678/grid/register -browser "browserName=firefox,setjavascriptEnabled=true,acceptSslCerts=true,maxInstances=5,platform=WINDOWS" -browser "browserName=internet explorer,setjavascriptEnabled=true,acceptSslCerts=true,platform=WINDOWS"

but when invoked with 3 browsers as shown below, the tests are failing with tcl error

Error: org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup {javascriptEnabled=true, acceptSslCerts=true, browserName=internet explorer} 



java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.ie.driver="C:\IEDriverServer.exe" -Dwebdriver.chrome.driver="C:\chromedriver.exe"-role node -hub http://x.x.x.x:5678/grid/register -browser "browserName=firefox,setjavascriptEnabled=true,acceptSslCerts=true,maxInstances=5,platform=WINDOWS" -browser "browserName=internet explorer,setjavascriptEnabled=true,acceptSslCerts=true,platform=WINDOWS" -browser "browserName=chrome,setjavascriptEnabled=true,acceptSslCerts=true,platform=WINDOWS"

How can the issue be resolved, can't we provide -Dwebdriver parameter multiple times?

Thanks in advance.

1

1 Answers

2
votes

Use your own custom node configuration instead of passing it through:

command

java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.ie.driver="C:\IEDriverServer.exe" -role node -hub http://x.x.x.x:5678/grid/register -nodeConfig config.json

config.json

{
  "capabilities":
      [
        {
          "browserName": "firefox",
          "version": "3.6",
          "platform": "WINDOWS",
          "maxInstances": 1
        },
        {
          "browserName": "internet explorer",
          "version": "8",
          "platform": "WINDOWS",
          "maxInstances": 1
        }
      ],
    "configuration":
        {
        "nodeTimeout":120,
        "port":5555,

        "hubPort":4444,
        "hubHost":"localhost",

        "nodePolling":2000,

        "registerCycle":10000,
        "register":true,
        "cleanUpCycle":2000,
        "timeout":30000,
        "maxSession":XXXXX,
        }
}

maxSession:XXXXX is the key. That will tell the node how many sessions it can have active at once.