I can see two remotes under the console but when I try to connect remotely and execute something it fails with a 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'
This doesn't appear to be a python error. It seems like the machine you have your selenium server on is refusing requests.
In the error message, you have an
<a href="http://jetty.mortbay.org/">Powered by Jetty://</a>
which got me thinking that it is somehow related to Jetty.
I don't know much about Jetty, but you might want to look there for your answers. One possible problem is that Jetty is also running 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 your setup on my local machine, to one of my servers (that doesn't have Jetty on it) and it worked perfectly fine.
Try running selenium hub using_
-port 5555
And then configure clients with also:
-port 5555
I think is an issue with another software using port 4444 or selenium is not starting in that port correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With