My current setup is I have a selenium RC running as a hub on a windows machine(lets assume machine name is machine.name.com). I have used the following command to start it
java -jar selenium-server2.15.jar -role hub -port 5555
I have a selenium node running on the same machine which is registered to the above node. I have used the following command to start the node
java -jar selenium-server2.15.jar -role node -port 5554 -hub http://machine.name.com:5555/grid/register
This node gets registered successfully, and I am able to run tests of this node as well.
Now I have another machine (a LINUX one - lets assume the ip address of this machine is 10.123.123.123), form where I wish to run another node registered to the hub on the windows (machine.name.com) machine at port 5555. I have used the following command to start the node.
java -jar selenium-server2.15.jar -role node -port 5572 -hub http://machine.name.com:5555/grid/register -browser browserName=chrome,platform=LINUX,maxInstances=5
The problem is that this node does not get registered by the HUB.
I do know for a fact that the Hub and Node have detected each other as when i hit http://machine.name.com:5555/console on the browser both the nodes are displayed. But the Linux machine has an error message alongside it "listening on http://10.123.123.123:5572 (cannot be reached at the moment)"
and no selenium tests can be run off that node.
I read on seleniumgroups HERE that the remote node must define the -hubHost
key value pair also.
So I have tried the following command as well, with no success
java -jar selenium-server2.15.jar -role node -port 5572 -hub http://machine.name.com:5555/grid/register -browser browserName=chrome,platform=LINUX, maxInstances=5 -hubHost "machine.name.com"
But this does not register the node as well.
Please note no error is thrown on the console on the linux machine. all that is displayed is -
13:20:55.891 INFO - starting auto register thread. Will try to register every 5000ms
13:20:55.891 INFO - Registering the node to hub :http://machine.name.com:5555/grid/register
13:23:06.860 INFO - Registering the node to hub :http://machine.name.com:5555/grid/register
13:25:17.678 INFO - Registering the node to hub :http://machine.name.com:5555/grid/register
13:27:28.496 INFO - Registering the node to hub :http://machine.name.com:5555/grid/register
13:29:39.311 INFO - Registering the node to hub :http://machine.name.com:5555/grid/register
No error are thrown on the console running the Hub on the windows machine.
Firewalls are appropriately punctured, as well checked by telneting.
With all of this, I am sure i have done something fundamentally wrong, can someone please HELP ME!!!!!
Thanks guys for helping out, but the problem was because the IP address of my node server was not routable.
So i created a host entry (DNS entry as well) for the node server.
and added another parameter -host
so the command now looks like
java -jar selenium-server2.15.jar -role node -port 5572 -hub http://machine.name.com:5555/grid/register -browser browserName=chrome,platform=LINUX, maxInstances=5 -hubHost "machine.name.com" -host "nodemachine.name.com"
thanks once again everyone.
To me it seems like you're doing it correctly. Have you tried the -debug flag when launching the node? Maybe you'll find something there.
And you probably want browserName=googlechrome instead of browserName=chrome
I faced a similar problem when hosting both node and hub on the local machine while I was on the VPN. I was able to get around this problem by launching both the hub and the node with the parameters -host and -port
For launching the hub the command looks something like this
java -jar selenium-server-standalone-2.32.0.jar -role hub -host <hubipaddress> -port 4444
For Launching the node the command looks something like this
java -jar selenium-server-standalone-2.32.0.jar -role node -host <nodeipaddress> -port 5555 -hub http://<hubipaddress>:4444/grid/register
In my case both hubipaddress and nodeipaddress are the same and they are the ip address assigned to me over the VPN
IF you are using a virtual machine you need to check your entropy. Selenium used urandom and if you don't have enough entropy it will take 1hour+ (if at all) for the node to come up.
On CentOS (and other distros) install:
yum install haveged
chkconfig haveged on
systemctl start haveged
Restart both services and Selenium should boot properly.
来源:https://stackoverflow.com/questions/8682742/selenium-grid2-remote-node-not-connecting-to-hub