Hi paragf! I checked your code.
Firstly, there seems to a syntax error at:
output = os.system(cmd))
this line should be:
output = os.system(cmd)
But this wouldn't be the cause for error.
I used the following to start the hub and register the node:
Code to start selenium hub on VM:
import os
def start_selenium_hub_on_vm():
cmd = "java -jar selenium-server-standalone-3.10.0.jar -role hub -port 4444"
output = os.system(cmd)
print 'executing command ', cmd
if output:
return output
else:
return -1
start_selenium_hub_on_vm()
The output when I run this code is as folllows:
![](https://www.edureka.co/community/?qa=blob&qa_blobid=16042471074562573662)
On your node, before trying to register it to the hub, make sure you have a config.json file. The config.json file should look something like this:
{
"capabilities":
[
{
"browserName": "firefox",
"marionette": true,
"maxInstances": 5,
"seleniumProtocol": "WebDriver",
"version": "62.0" //Your browser version
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 5555, //Port on which the hub is running
"register": true,
"registerCycle": 5000,
"hub": "http://192.168.111.132:5555", //URL displayed for Node to register when you start the hub
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
The python script to register node to hub:
import os
def register_node_to_hub():
cmd = "java -jar selenium-server-standalone-3.10.0.jar -role node -nodeConfig config.json"
output = os.system(cmd)
print 'executing command ', cmd
if output:
return output
else:
return -1
register_node_to_hub()
The output I get:
![](https://www.edureka.co/community/?qa=blob&qa_blobid=12290973664342299411)
The error you are getting is usually got because of incompatible version. The version that successfully worked for me:
Firefox: 62.0
geckodriver-v0.19.1
selenium-server-standalone-3.10.0.jar
Python 2.7.15
Reference: https://www.linode.com/docs/development/nodejs/install-configure-selenium-grid-ubuntu-16-04/