Getting 404 in / wd / hub / session when I try to connect to selenium grid remotely via Python

I see two remote controls under the console, but when I try to connect remotely and perform something that it is not with 404.

from selenium import webdriver browser = webdriver.Remote( command_executor='http://ec2-184-72-129-183.compute-1.amazonaws.com:4444/wd/hub', desired_capabilities={'browserName': 'firefox'}) browser.get('http://www.google.com') browser.quit() 

Throws this exception

 Traceback (most recent call last): File "browser-shot.py", line 16, in <module> desired_capabilities={'browserName': 'firefox'}) File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 62, in __init__ self.start_session(desired_capabilities, browser_profile) File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 104, in start_session 'desiredCapabilities': desired_capabilities, File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 155, in execute self.error_handler.check_response(response) File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 125, in check_response raise exception_class(value) selenium.common.exceptions.WebDriverException: Message: '<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>\n<title>Error 404 </title>\n</head>\n<body><h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre>\n<p>RequestURI=/wd/hub/session</p><p><i><small><a href="http://jetty.mortbay.org/">Powered by Jetty://</a></small></i></p><br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n<br/> \n\n</body>\n</html>\n' 
+8
python selenium selenium-webdriver selenium-grid
source share
2 answers

This is not like a python error. It seems that the machine on which you have a selenium server is refusing requests. In the error message, you have a <a href="http://jetty.mortbay.org/">Powered by Jetty://</a> which made me think it was somehow connected to the Berth.

I am not very familiar with Jetty, but you can see your answers there. One of the possible problems is that Jetty also works on port 4444, but I can’t say for sure, because I don’t know how Jetty works.

EDIT

I should also add that I tried the setup on my local computer, on one of my servers (it does not have Jetty), and it worked fine.

+2
source share

Try starting the selenium hub using _

 -port 5555 

And then configure the clients as well:

 -port 5555 

I think that the problem with other software using port 4444 or selenium does not start on this port correctly.

+1
source share

All Articles