0

i have started selenium server hub by running command : java -jar selenium-server-standalone-3.4.jar -port 4444 -role hub

i have also connected node by running the command : java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://XXX.XXX.XXX.XXX:4444/grid/register/ -browser -browserName=firefox -port 5580

grid node

in grid console its showing v:null(don't know why?).

i am runing below code to run selenium :

    public static void main(String[]  args) throws MalformedURLException, InterruptedException{

    String URL = "http://www.DemoQA.com";
    String Node = "http://localhost:4444/wd/hub";
    DesiredCapabilities cap = DesiredCapabilities.firefox();
    cap.setBrowserName("firefox");
    cap.setPlatform(Platform.WIN10);


    driver = new RemoteWebDriver(new URL(Node), cap);

    driver.navigate().to(URL);
    Thread.sleep(5000);
    driver.quit();
}

`

enter image description here

gettinf these errors, someone please help with these?.

many thanks in adc

jaibalaji
  • 3,159
  • 2
  • 15
  • 28
  • Try switching the command line properties to before `-jar`. See https://github.com/SeleniumHQ/selenium/issues/2566 – HaC Aug 24 '17 at 21:27

2 Answers2

1

Grid console shows no instance for Firefox is the issue you faced. There seems to be some issue with your node.

Check the node registration command.

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://XXX.XXX.XXX.XXX:4444/grid/register/ -browser browserName=firefox,platform=WINDOWS,maxInstances=2

Try removing the - before browserName in the command.

Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
Giri
  • 411
  • 2
  • 18
0

The error message Error forwarding the new session cannot find is the Grid's way of telling you that whatever you requested for, the hub couldn't find any node that supports that capability.

In your case, when you did this

DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setBrowserName("firefox");
cap.setPlatform(Platform.WIN10);

You are basically telling the hub that you need a node that can support a browser with its name as firefox and the node should be running on a Windows 10 Operating system.

But in your node starting command, you used this

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://XXX.XXX.XXX.XXX:4444/grid/register/ -browser -browserName=firefox -port 5580

which means you registered a node which supports firefox browsers, to the Hub, but you never mentioned anything about the platform. So the node assumes the platform to be "any".

Now when you created a new RemoteWebDriver instance, the Hub tried matching the requested capabilities with the available capabilities of every node. Since it didn't find any node that runs on Windows 10 and supports firefox (Remember you only have a node that supports firefox and whose platform is not set), the matching fails because "ANY" is not a match with "WIN10".

To fix the problem, please remove the line cap.setPlatform(Platform.WIN10); and try again.

PS : The line DesiredCapabilities cap = DesiredCapabilities.firefox(); already figures out the browser name, so you don't need to explicitly set the browser name via cap.setBrowserName("firefox");

Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66