1

I'm using Selenium 2.25.0 with Python 2.7.1 bindings on a Mac. I'm encountering a socket error when I run this:

# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium import selenium 
import unittest, time, re, base64, urllib, httplib, urllib2

#Create Selenium object
browser = selenium("localhost", 4444, "*firefox", "http://www.google.com/")
#Start browser
browser.start()

And then on the last step (browser.start) I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/selenium.py", line 189, in start
    result = self.get_string("getNewBrowserSession", start_args)
  File "/Library/Python/2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/selenium.py", line 223, in get_string
    result = self.do_command(verb, args)
  File "/Library/Python/2.7/site-packages/selenium-2.25.0-py2.7.egg/selenium/selenium.py", line 212, in do_command
    conn.request("POST", "/selenium-server/driver/", body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 941, in request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 975, in _send_request
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 937, in endheaders
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 797, in _send_output
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 759, in send
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 740, in connect
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection
socket.error: [Errno 61] Connection refused

I've tried fiddling with different ports, but this does not solve the issue. Apologies if there's something obvious I'm missing here. Thanks for your help!

1 Answer 1

2

Before running the script you must start the server. Go to the directory where Selenium RC’s server is located and run the following from a command-line console. You can find more instructions here.

java -jar selenium-server-standalone-<version-number>.jar
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Whoops, that's obvious.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.