TIMEX
TIMEX

Reputation: 271794

Selenium seems to work, but then gets a timeout error?

$ java -jar selenium-server-standalone-2.0b3.jar 

00:17:03.883 INFO - Java: Sun Microsystems Inc. 19.0-b09
00:17:03.885 INFO - OS: Linux 2.6.32-305-ec2 i386
00:17:03.889 INFO - v2.0 [b3], with Core v2.0 [b3]
00:17:04.501 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
00:17:04.530 INFO - Version Jetty/5.1.x
00:17:04.531 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
00:17:04.532 INFO - Started HttpContext[/selenium-server,/selenium-server]
00:17:04.532 INFO - Started HttpContext[/,/]
00:17:04.614 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@13c5982
00:17:04.614 INFO - Started HttpContext[/wd,/wd]
00:17:04.618 INFO - Started SocketListener on 0.0.0.0:4444
00:17:04.618 INFO - Started org.openqa.jetty.jetty.Server@1ffb8dc

When I run this script:

from selenium.webdriver.common.keys import Keys
import time

browser = webdriver.Remote('http://localhost:4444/wd/hub', {'browser_name':'firefox','platform':'ANY', 'version':'','javascript_enabled':True})
browser.get("http://www.yahoo.com")

The Selenium server seems to work at first:

00:17:08.776 INFO - Executing: [new session: {platform=ANY, browser_name=firefox, javascript_enabled=true, version=}] at URL: /session)

But then I get a python error:

Traceback (most recent call last):
  File "fb2.py", line 13, in <module>
    browser = webdriver.Remote('http://localhost:4444/wd/hub', {'browser_name':'firefox','platform':'ANY', 'version':'','javascript_enabled':True})
  File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 60, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 96, in start_session
    'desiredCapabilities': desired_capabilities,
  File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 142, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 100, in check_response
    raise exception_class(message)
selenium.common.exceptions.WebDriverException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

Upvotes: 1

Views: 3922

Answers (1)

Mike Kwan
Mike Kwan

Reputation: 24447

Looks like you're using Selenium Grid. The grid consists of a hub and nodes which connect to it. When you run a test you send a request to the server which dispatches it accordingly to a host with the appropriate configuration according to what you defined in desired_capabilities. In this case you don't seem to have started a node anywhere.

You have failed to start a node it seems. Also I believe to use a WebDriver requires Grid 2.0. As I understand it, the build you are using only has Grid support for RC API. You can use the following guide if you download and compile the current trunk: http://code.google.com/p/selenium/wiki/Grid2

Upvotes: 2

Related Questions