Question

I am behind a proxy server. Using Selenium 2.39, Python 2.7.6 and ChromeDriver 2.9, whenever I call .quit() on an instance of Chrome, I get an HTTP 407 error. No such error occurs when using FirefoxDriver.

Traceback (most recent call last):
File "C:\Users\Tetrinity\Desktop\chrometest.py", line 7, in <module>
    browser.quit()
  File "C:\Python27\lib\site-packages\selenium-2.39.0-py2.7.egg\selenium\webdriver\chrome\webdriver.py", line 82, in quit
    self.service.stop()
  File "C:\Python27\lib\site-packages\selenium-2.39.0-py2.7.egg\selenium\webdriver\chrome\service.py", line 97, in stop
    url_request.urlopen("http://127.0.0.1:%d/shutdown" % self.port)
  File "C:\Python27\lib\urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 410, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 407: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied.  )

The problem can be reduced to the following script, which I have saved as chrometest.py (as seen in the above stacktrace):

from selenium import webdriver
browser = webdriver.Chrome()
browser.get("http://www.google.co.uk")
browser.quit()

This script successfully opens Chrome and navigates to Google. The .quit() then causes the above crash, leaving a dead ChromeDriver instance lying around. What could be causing this, and how can I prevent it?

Research has turned up a lot of answers that aren't quite relevant, overcomplicate things or claim it's an issue that was already fixed.

Was it helpful?

Solution

Since I wasted several hours today trying to track down a solution, I thought I'd document what worked for me. I fixed this problem by opening Internet Options > Connections > LAN settings > Advanced and inserting 127.0.0.1 into the Exceptions box. After doing this, chrometest.py completed without error and the ChromeDriver window was successfully closed.

Credit for this solution should go to the question-asker here. Oddly enough, this question never appeared in my searches. It appeared in the Similar Questions section when I was nearly finished typing up the original version of this question (go figure!).

OTHER TIPS

This is an issue on Chrome browser. The following steps will give you the fix.

1| Uncheck the Check Box, By Proxy server for local address

enter image description here

2| Click on Advanced Tab

enter image description here

3| Enter 127.0.0.1 under Exceptions panel

4| Click ok

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top