Firefox WebDriver crashes with httplib.BadStatusLine
Meta -
OS: Linux (Debian Jessie) Selenium Version: 2.53.6 (python bindings) Browser: Firefox Browser Version: 47.0.1
Expected Behavior -
Selenium will successfully navigate to a page (http://taobao.com). When manually navigated in the browser this completes sucessfully.
Actual Behavior -
The webdriver and browser crash with httplib.BadStatusLine.
Steps to reproduce -
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://taobao.com")
driver.close()
Traceback (most recent call last):
File "test_firefox.py", line 4, in <module>
driver.get("http://taobao.com")
File "python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 248, in get
self.execute(Command.GET, {'url': url})
File "python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
return self._request(command_info[0], url, body=data)
File "/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 433, in _request
resp = self._conn.getresponse()
File "/usr/lib/python2.7/httplib.py", line 1073, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 415, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 379, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ''
This issue is also reproducible on MAC with firefox version 47.0 and selenium version 2.52
Can't reproduce in my system:
$ cat taobao.py from selenium import webdriver driver = webdriver.Firefox() driver.get("http://taobao.com") driver.close() $ python taobao.py $ date Ter Jul 26 19:36:01 WEST 2016 # This current time == GMT+1 $ python --version Python 2.7.10 $ uname -a Linux new-host 4.4.14-200.fc22.x86_64 #1 SMP Fri Jun 24 21:19:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux $ firefox --version Mozilla Firefox 45.1.0 # This is latest Firefox ESR $ pip list (...) selenium (2.53.2) (...)
On Tue, Jul 26, 2016 at 7:00 PM, Sripathi Pai [email protected] wrote:
This issue is also reproducible on MAC with firefox version 47.0 and selenium version 2.52
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium/issues/2524#issuecomment-235352325, or mute the thread https://github.com/notifications/unsubscribe-auth/ACu9xkPqWU6_tuLa5cjfIGD8QO3XnCZgks5qZktIgaJpZM4JVYMY .
Additional version information, for what it's worth:
$ python --version
Python 2.7.9
$ uname -a
Linux localhost 3.14.0 #1 SMP PREEMPT Wed Jul 6 18:18:53 PDT 2016 x86_64 GNU/Linux
$ firefox --version
Mozilla Firefox 47.0.1
$ pip list |grep selenium
selenium (2.53.6)
I'll try with the firefox-esr and see if that works then report back.
Unfortunately, @HelioGuilherme66 even when using the ESR release (45.2.0) I still have this error.
test_firefox.py is the same code I referenced above
$ firefox --version
Mozilla Firefox 45.2.0
$ python test_firefox.py
Traceback (most recent call last):
File "test_firefox.py", line 4, in <module>
driver.get("http://taobao.com")
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 248, in get
self.execute(Command.GET, {'url': url})
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
return self._request(command_info[0], url, body=data)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 433, in _request
resp = self._conn.getresponse()
File "/usr/lib/python2.7/httplib.py", line 1073, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 415, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 379, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ''
Also tried with selenium==2.53.2 to further match your configuration and it still crashed.
Looks like the problem is with httplib.py. I have upgraded selenium to 2.53.6 and still runs OK. Differences in Python 2.7.9 vs 2.7.10?
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 433, in _request
resp = self._conn.getresponse()File "/usr/lib/python2.7/httplib.py", line 1073, in getresponse response.begin() File "/usr/lib/python2.7/httplib.py", line 415, in begin version, status, reason = self._read_status() File "/usr/lib/python2.7/httplib.py", line 379, in _read_status raise BadStatusLine(line) httplib.BadStatusLine: ''
I've tried across a number of other configuration and in some cases it works fine, but I'm having difficulty pinning down what is broken on this one system (only major difference I haven't isolated is the kernel version). I would be happy to continue trying to help trouble shoot this bug if anyone has any other ideas, otherwise feel free to close this since it is inconsistently reproducible.
To summarize
The original system still fails (even with 2.7.10), tested the following configurations: Debian Jessie Linux localhost 3.14.0 #1 SMP PREEMPT Wed Jul 6 18:18:53 PDT 2016 x86_64 GNU/Linux Mozilla Firefox 47.0.1 + (python 2.7.9 or 2.7.10) Mozilla Firefox 45.2.0 + python 2.7.9
On a fresh testing VM everything seems to work without issue (including python 2.7.9) Debian Stretch Linux vagrant 4.6.0-1-amd64 #1 SMP Debian 4.6.4-1 (2016-07-18) x86_64 GNU/Linux Mozilla Firefox 45.2.0 + (python 2.7.9, 2.7.10, 2.7.12)
On another system everything also seems to work without issue (python 2.7.9) Debian Jessie Linux tower 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux Mozilla Firefox 45.2.0 + python 2.7.9
I was just about to post that I got the same problem on my mac running Firefox 47 and Selenium 2.53.6. While checking the Firefox version (graphically) I updated to Firefox 47.0.1. Now, I don't know if it really had anything to do with it, but suddenly it works. No clue!
![Firefox 47 is failing]
https://www.evernote.com/l/AFMig-jiNV5IHoDd52bcfKe-2XqOYzrSuFoB/image.png
If the browser is crashing, and by crashing I mean it is no longer open (the true meaning of a crash), then there is a bigger problem than Selenium just not doing things. Can you see if you can replicate this with Selenium 3.0 beta?
I've also encountered the issue with selenium 2.53.6 / Firefox 47.0.1/Python 2.7.6, do you guys have anything that can fix this or something workaround about this?
@HardenDev I had the same environment and met the same bug as yours. I solved this bug through updating firefox to 48.0. It worked perfectly on selenium 2.53.6 / Firefox 48.0 /Python 2.7.6.
@royragsdale I also have the same issue with python 2.7.11/Chrome 54.0.2840.87 m/selenium 3.0.1,do you have something to solve?thanks a lot.
@zqy16 unfortunately I never did pin down a good solution.
I can reproduce it on my server, but not on my Mac. Instead using PhantomJS as the driver, instead of Firefox.
Mac: OSX El Capitan 10.11.6 Server: CentOS 7.2.1511 Both have PhantomJS version: 2.1.1 Python Mac: Python 2.7.11 Python Server: 2.7.5 Both have Selenium version: 2.53.0
@royragsdale ,i use Chrome 52.0.2743.82 m (64-bit),and the problem solved.
I had the same error on OSX 10.10, Chrome 55, Selenium 3.0.2. I grabbed the latest chromedriver 2.27 and its working now: https://chromedriver.storage.googleapis.com/index.html?path=2.27
@andrewgtp @zqy16 please stop suggesting Chrome as a bug patch to Firefox.
@alexbegun that sounds like a completely different issue... not sure why you hijacked this thread
Can not reproduce it. Windows 10 Python 2.7/3.4 Selenium 3.3.1 Firefox 52.0.2 geckodriver 0.15.0
Guys look at this: https://code.google.com/archive/p/httplib2/issues/250