9

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' 
3
  • I have a similar problem. It seems either /wd/hub/session isn't being served by selenium or the Remote is looking for a resource in the wrong place.
    – munk
    Jan 9, 2013 at 22:04
  • 1
    Its a shot in the dark, since i'm not familiar with Python bindings, but this could be connection related, i have several problems where i could connect to the grid via IDE but wasn't possible on Hudson/Jenkins.
    – aimbire
    Jan 15, 2013 at 19:28
  • I recomend you to remove the aws url from the example... you know, just in case :) Jan 16, 2013 at 21:01

2 Answers 2

2

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.

6
  • 3
    I think Jetty is the webserver that selenium grid runs on top of. If Jetty were running as a separate process there, wouldn't either Jetty or the grid throw a binding error when starting, saying the port is in use?
    – munk
    Jan 16, 2013 at 18:56
  • Wait, are you using the standalone server for selenium?
    – jyapayne
    Jan 16, 2013 at 21:28
  • Also, can you post your selenium version?
    – jyapayne
    Jan 16, 2013 at 21:35
  • I'm using selenium grid 1.0.8. I'm starting the grid with ant launch-hub
    – munk
    Jan 16, 2013 at 22:58
  • Could you try to use the standalone server that is here: selenium.googlecode.com/files/…
    – jyapayne
    Jan 17, 2013 at 0:53
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.