1

I am trying to use selenium for Python and am having trouble running even a basic program just to get familiar with the selenium. For now, I am just trying to open a webpage and can't even get that to work. I know there are easier ways to launch a webpage with python, but my goal is to work with the webpage content later, so that is why I am using selenium.

from selenium import webdriver

browser = webdriver.Firefox()
browser.get("http://www.stackoverflow.com")

This results in this error message followed by launching a blank firefox window...

Traceback (most recent call last):
  File "C:\Python33\Learning Python\soundcloud_play.py", line 10, in <module>
    browser.get("http://www.stackoverflow.com")
  File "C:\Python33\lib\site-packages\selenium-2.38.4-py3.3.egg\selenium\webdriver\remote\webdriver.py", line 176, in get
self.execute(Command.GET, {'url': url})
  File "C:\Python33\lib\site-packages\selenium-2.38.4-py3.3.egg\selenium\webdriver\remote\webdriver.py", line 162, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Python33\lib\site-packages\selenium-2.38.4-py3.3.egg\selenium\webdriver\remote\remote_connection.py", line 349, in execute
    return self._request(url, method=command_info[0], data=data)
  File "C:\Python33\lib\site-packages\selenium-2.38.4-py3.3.egg\selenium\webdriver\remote\remote_connection.py", line 377, in _request
    resp = self._conn.getresponse()
  File "C:\Python33\lib\http\client.py", line 1143, in getresponse
    response.begin()
  File "C:\Python33\lib\http\client.py", line 354, in begin
    version, status, reason = self._read_status()
  File "C:\Python33\lib\http\client.py", line 324, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: ''

I don't understand what this problem is or how to go about fixing it. I am running Windows 7, Python 3.3.2, Selenium 2.38.4, Firefox 17.0.10

Any ideas would be greatly appreciated. Thanks.

1 Answer 1

3

Try upgrade your Firefox to 25 (recommended), or downgrade your Selenium to 2.27 (not recommended.)

Changelog is here.

Note that Selenium 2.39 just got out, which supports Firefox 26.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I upgraded to Firefox 26 and that solved the problem. I didn't even realize I was running such an old version of Firefox.

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.