1

I am running a Selenium Hub from my local PC and now I am trying to register a node from an ec2 instance via SSH. This is how I ran my Hub:

java -jar -Dwebdriver.chrome.driver=C:\\Users\\NROLL97\\Documents\\chromedriver.exe selenium-server-standalone-3.141.59.jar -role hub -port 4444

This is how I can tell it worked: hub running

I am SSH'ed into my ec2 instance and I tried the following:

java -jar selenium-server-standalone-3.141.59.jar -role node -port 5555 -hub http://192.168.86.31:4444/grid/register

But this is what I get back:

console

I read that it might have something to do with AWS blocking port 4444 so I tried editing this in AWS console like this: AWS console

but still nothing. How can I get this node to register? When I make the node on my local PC then it works just fine.

But like this the node doesn't actually get registered.

EDIT: I also tried the following:

  1. Started the HUB: java -jar selenium-server-standalone-3.141.59.jar -role hub
19:04:08.076 INFO [GridLauncherV3.lambda$buildLaunchers$5] - Launching Selenium Grid hub on port 4444
2020-09-11 19:04:08.411:INFO::main: Logging initialized @562ms to org.seleniumhq.jetty9.util.log.StdErrLog
19:04:08.773 INFO [Hub.start] - Selenium Grid hub is up and running
19:04:08.773 INFO [Hub.start] - Nodes should register to http://192.168.86.31:4444/grid/register/
19:04:08.773 INFO [Hub.start] - Clients should connect to http://192.168.86.31:4444/wd/hub
  1. Started the node from an ec2 instance that I am SSH'ed into: java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.86.31:4444/grid/register
]java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.86.31:4444/grid/register
23:16:40.963 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
23:16:41.167 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 11391
2020-09-11 23:16:41.302:INFO::main: Logging initialized @698ms to org.seleniumhq.jetty9.util.log.StdErrLog
23:16:41.666 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
23:16:41.795 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 11391
23:16:41.799 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub
23:16:41.918 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.

It looks like it just keeps trying but never connects. I I go to the grid console then I can see that there are no nodes connected, its blank.

mastercool
  • 463
  • 12
  • 35
  • The ip 192.168.86.31 is a local/private address which is likely not accessible from the outside. Unless you've setup a VPN, you'll have to use your external IP with a NAT rule pointing to your local address. – Florent B. Sep 14 '20 at 11:15
  • I think it’s fine though because I can access the selenium grid from another computer using that IP if I remember correctly – mastercool Sep 14 '20 at 11:54
  • But how can I know for sure – mastercool Sep 14 '20 at 11:56
  • It would work on another station if that station is on the same network. An IP starting by 192.168 is a private IP and is only accessible directly within the same network. Your ec2 instance is on a different network. Use a VPN or your public IP with a NAT rule (https://checkip.amazonaws.com). – Florent B. Sep 14 '20 at 12:38
  • Okay I’ll look into this! Thanks! – mastercool Sep 14 '20 at 14:17
  • Can you share a link to an article or something of what you mean? I clicked that link and it showed my IP but I want to make sure I am following the right instructions. – mastercool Sep 14 '20 at 15:18
  • sure: [how to access a private ip from outside](https://www.google.com/search?q=how+to+access+a+private+ip+from+outside) – Florent B. Sep 14 '20 at 16:35

2 Answers2

1

Assuming that the requirement is to run the Selenium Grid Hub on default port 4444 and Selenium Grid Node on default port 5555 you need to configure and start them as follows:

  1. Start the Selenium Grid Hub:

    java -jar selenium-server-standalone-3.141.59.jar -role hub
    
  2. The following logs confirms your Selenium Grid Hub is running properly:

    2017-07-24 15:31:46.139:INFO:osjs.Server:main: Started @2757ms
    15:31:46.140 INFO - Nodes should register to http://192.168.0.107:4444/grid/register/
    15:31:46.140 INFO - Selenium Grid hub is up and running
    
  3. Access the Selenium Grid Console through the URL:

    http://localhost:4444/grid/console
    
  4. Start the Selenium Grid Node:

    java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.86.31:4444/grid/register
    
  5. The following logs confirms your Selenium Grid Node is running properly:

    15:35:44.939 INFO - Selenium Grid node is up and ready to register to the hub
    15:35:44.958 INFO - Starting auto registration thread. Will try to register every 5000 ms.
    15:35:44.958 INFO - Registering the node to the hub: http://localhost:4444/grid/register
    15:35:45.231 INFO - The node is registered to the hub and ready to use
    
  6. Access the Selenium Grid Console through the console URL to see the registered Node:

    http://localhost:4444/grid/console
    

Reference

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • This didn't work. this is essnitally what I already have, so its giving me the same exact logs. `Selenium Grid node is up and ready to register to the hub 23:07:24.585 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.` . This works when the node and hub are on the same computer but my node is on an ec2 instance – mastercool Sep 11 '20 at 23:08
  • @mastercool IMO, you are overlooking something. You need to start the Hub without the binaries. – undetected Selenium Sep 11 '20 at 23:11
  • I did exactly as you have there with the same error though. I tried without the binaries. I'm not sure what else it could be – mastercool Sep 11 '20 at 23:12
  • @mastercool Can you update the question with the complete error trace logs of Hub and Node both? – undetected Selenium Sep 11 '20 at 23:13
  • I just added it in! – mastercool Sep 11 '20 at 23:18
  • @mastercool Whats wrong with port `5555`? As we have used the default configuration Node should start on port `5555` but it seems starting on port `11391` – undetected Selenium Sep 11 '20 at 23:29
  • Idk but if I use `java -jar selenium-server-standalone-3.141.59ar -role node -port 5555 -hub http://192.168.86.31:4444/grid/register` then the port is `5555` but still has the original error – mastercool Sep 11 '20 at 23:33
  • @mastercool Seems there is some service running on port `5555` which is stopping the Node. Leave out port `5555` for the time being and try to use `-port 6666` or `-port 11391` – undetected Selenium Sep 11 '20 at 23:39
  • Which JDK version? – undetected Selenium Sep 11 '20 at 23:48
  • JRE 1.8 it should be – mastercool Sep 11 '20 at 23:48
  • @mastercool , did you manage to resolve this? I'm getting the exact same issue with a similar setup. Any pointers are most welcome. – Tinashe Chinyanga Jul 30 '21 at 08:16
  • yes, I resolved this. It was the access that was causing the problem. Make sure that the hub and node both allow access from any IP address on all ports to see if this fixes your issue. From there, you can add the correct security rule. – mastercool Jul 30 '21 at 11:58
1

I used AWS Elastic IP's to fix this problem. With the Elastic IP, I can make my private IP go public. So I made both the HUB and Node an AWS EC2 instance, then the hub is visible to the node if you give the elastic IP to the hub.

mastercool
  • 463
  • 12
  • 35