78903

Unable to connect to Selenium Grid running on AWS EC2

Question:

I have a Selenium Grid up and running on an AWS EC2 instance. I would like to connect to this from my local machine using Java to fire off my tests via a RemoteWebDriver, however, I'm unable to connect to the server be it through SSH or the Public IP.

For example I need to access the instance on port <em>4444</em> for a url of <a href="http://123.456.78.910:4444/wd/hub" rel="nofollow">http://123.456.78.910:4444/wd/hub</a> this would then need to establish a connection and receive my tests.

Whenever I try to use the Public IP I simply get a time-out.

Any help would be greatly appreciated.

Answer1:

You are getting a time out because your port 4444 is blocked in the EC2 security group. Check below you have add that rule to you EC2 security group. You can either add 0.0.0.0/0 but I will suggest just add your IP as you will be the only one to access that port from your local and for better security.

<a href="https://i.stack.imgur.com/eo2m0.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/eo2m0.png" data-original="https://i.stack.imgur.com/eo2m0.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Answer2:

When you start a selenium grid hub - you are shown a message such as : register node to the hub: http://{hub-ip}:4444/grid/register

When i tried to register a node with hub-ip , it did not work for me. so i checked the public-ip of my ec2 instance by logging in to the ec2 console.

then i registered the node with http://{public-ip}:4444/grid/register it worked.

so use public ip of ec2 instance to register the node. the hub-ip duggested by selenium grid did not work for me on ec2

if i place hub , node on local machine - then none of this problem occurs.

are you running node and hub on different ec2 instances ? You should also add the <strong>remotehost</strong> option while starting a node from an instance different from the hub instance to tell the hub about your ip address.

java -Dwebdriv.gecko.driver="geckodriver" -jar selenium-server-standalone-3.13.0.jar -role node -hub http://{hub-public-ip}:4444/grid/register/ -remoteHost "http://{node-public-ip}" public ip of script instance - 34.224.113.203

Recommend

  • How do I connect to a local server run by Aptana from an outside network?
  • Javascript regexp that matches '.' not preceded by '\\' (lookbehind alternativ
  • HTTP request to update rails model from arduino
  • Allow multiple IPs to access Wordpress Site Admin via .htaccess
  • SyntaxError: Unexpected token import when trying to import protractor in e2e test for angular
  • Understand alignment sentence in inotify example
  • calculate atan2 from two raster object in R?
  • Not able to open a portlet in liferay dialog
  • Using Wikidata label service in federated queries
  • inotify missing events
  • Headless protractor not sharding tests
  • Appium + Android + WebDriver findElement() : cannot find element after sendKeys()?
  • Change language on Firefox with Selenium Python
  • How to get executing server name or address with Selenium Server 2.20
  • How to get a list of songs, artists, albums on WP7 devices?
  • Alternative for django.db.close_connection()
  • Security Issue on Accessing Remote Image with dompdf
  • Cannot establish BLE connection between Android 5 and BLE device
  • Extract decision boundary with scikit-learn linear SVM
  • read values from form post in jquery or javascript
  • apply a javascript function to draggable copy
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',)
  • Check for zero lines output from command over SSH
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • WPF ICommand CanExecute(): RaiseCanExecuteChanged() or automatic handling via DispatchTimer?
  • How solve “Qt: Untested Windows version 10.0 detected!”
  • Limiting recursion to certain level - Duplicate rows
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Javascript Callbacks with Object constructor
  • How can I use Kendo UI with Razor?
  • Display Images one by one with next and previous functionality
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Turn off referential integrity in Derby? is it possible?
  • How can I remove ASP.NET Designer.cs files?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • JaxB to read class hierarchy