0

I am trying to setup Selenium Grid for the first time. I was able to run the hub, and a local node as well. Once I try to run a node on a VM, I get an error saying:

INFO - Couldn't register this node: Error sending the registration request: Connect to :4445 [/] failed: Connection timed out: connect

INFO - Couldn't register this node: this The hub is down or not responding: Connect to :4445 [/] failed: Connection timed out: connect

I've run the hub with:

java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4445

The local node with

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4445/grid/register/

And tried to run the remote node both with

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://<local machine ip>:4445/grid/register/

and with

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://<host ip>:4445/grid/register/

I took the from the message in the hub terminal session:

12:24:55.593 INFO - Nodes should register to http://:4445/grid/register/

I opened ports 4444 and 4445(just in case) in both sides(hub and node) firewalls.

Anyone has any idea why it might not work, and what can I do to help the new node to connect my hub?

Thx

edit after Murthi first comment: I tried to run both:

java -jar selenium-server-standalone-3.4.0.jar -role node -hub <hub-machine-ip>

and:

java -jar selenium-server-standalone-3.4.0.jar -role node -hub <hub-machine-ip> -hubHost <host-ip>

and in both cases, the cmd listed me all the options of Selenium Grid.

I also tried to run:

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://<hub-machine-ip>:4445/grid/register -host <host-ip>

and I got back to the error I received earlier of the Connection timeout

Edit 25/7: The hub OS is Mac OS x Yosemite The node OS is Windows 7 SP1 I ran the hub creation from the hub machine and the node creation from the node machine. The error I receive is always the same: INFO - Couldn't register this node: The hub is down or not responding: Connect to :4444 [/] failed:Connection timed out: connect I see this message on the command line terminal, on the node machine

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
Y. Serrouya
  • 41
  • 1
  • 10

2 Answers2

1

When you start off a node, Selenium tries figuring out what your IP address is and then uses that to register itself to the hub. In some cases your machine may have two IP addresses (One that is exposed and one that is not) and selenium may find the one that is not exposed and use it to register itself. When this happens the node would send a registration request to the hub and the registration would be succeeded as well, but the hub on its side tries to poll the node periodically to check if the node is alive and if not it would mark the node as defunct and remove it off. When the hub tries to ping the node, it would use the id that the node identifies itself with (the id is most often formed using the IP and Port of the node which the node sent).

Here's what you can try doing to figure out where exactly is the bottle neck.

First we need to find out if there's really a port (or) IP issue on your node which is causing the havoc. For this, on your node machine, start the node using the below command

java -jar selenium-server-standalone-3.4.0.jar -role node

This spins off a Selenium node which listens on 5555 port and which tries to register itself to a hub running on localhost and listening on port 4444. You will see a lot of failures on your screen (just ignore them for now).

Now from a different machine try triggering a HTTPGET (via wget or via curl or by opening up the below URL on a web browser)

http://<IP_Of_Node_Machine_Goes_Here>:5555/assets/selenium.png

You should get the selenium logo downloaded (or) visible on your browser.

If you are getting issues, in this step it basically confirms that you either have a IP issue (or) a port issue.

To figure out which of them it is, first try switching to a different port such as 8080 and start the node on it using the command

java -jar selenium-server-standalone-3.4.0.jar -role node -port 8080

and try hitting http://<IP_Of_Node_Machine_Goes_Here>:8080/assets/selenium.png

If you see the logo now, then it means it was indeed 5555 that was being blocked on your node machine for incoming traffic (You would need to open it up)

If you still didnt see the logo, then you are most probably facing the internal IP/external IP issue. For fixing this figure out what is the IP of the box that is being exposed outside and provide that via the -host parameter when you start the node.

The other option would be to fall back to having both your Hub and Node run on 8080 port (since they are running on different machines, you shouldn't have any port contention). The reason why I suggest 8080 is because most often this port is never blocked because that's the default Http port.

Hope that helps fix your issue.

Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66
  • Hi Krishnan! Thanks for the advice! I am seeing the selenium logo from the first try though, so I guess it's not ip/port related issue. Do you happen to have any other ideas? – Y. Serrouya Jul 25 '17 at 08:41
  • Can you please tell me the following ? The OS of Hub and the OS of node ? From which machine did you run load the URL ? I am assuming it was from the Hub machine or a third machine and not from the node machine. Also can you please help edit your question and add the stacktrace of the error that you are seeing along with details on from which machine do you see this. There's obviously nothing that stands out here as a problem so am guessing its something at the network thats wrecking havoc. So the more info you share the better it is. – Krishnan Mahadevan Jul 25 '17 at 09:20
0

you start the hub in local machine using

java -jar selenium-server-standalone-3.4.0.jar -role hub 

and node on vm using

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://<host ip>:4444/grid/register/ 

Enable TCP/UDP port forwarding 4444 on vm node and 5555 on the hub machine. This may work for you.

Murthi
  • 5,299
  • 1
  • 10
  • 15
  • should I give as the hub machine? or the selenium grid host? those are two separate ips for me. – Y. Serrouya Jul 20 '17 at 12:41
  • host ip is IP of your hub machine. if you are running hub in local machine. then you need to find ip of your local machine and give the same ip in your node registration request. – Murthi Jul 20 '17 at 12:45
  • It doesn't work either. I opened all the ports in the firewalls(both local and remote), and still gets connection timed out – Y. Serrouya Jul 20 '17 at 12:51
  • which OS you have ? windows or linux or mac? – Murthi Jul 20 '17 at 12:52
  • You have to open both TCP and UDP port. – Murthi Jul 20 '17 at 12:53
  • Remote is windows, local is Mac. And yes, both TCP and UDP, both 4445 and 5555 (port 4444 is already in use in my environment, so I've set it as 4445) – Y. Serrouya Jul 20 '17 at 12:54
  • It is port close issue. I am not worked on mac more. Sorry, I couldn't help you on this. – Murthi Jul 20 '17 at 13:00