我在代理服务器后面。使用Selenium 2.39,Python 2.7.6和ChromeDriver 2.9,只要我在Chrome实例上调用.quit()
,就会得到HTTP 407错误。使用FirefoxDriver时不会出现此类错误。Selenium ChromeDriver - driver.quit上的HTTP 407()
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. )
的问题可以归纳为以下的脚本,我已经保存为chrometest.py
(如上面的堆栈跟踪看到):
from selenium import webdriver
browser = webdriver.Chrome()
browser.get("http://www.google.co.uk")
browser.quit()
这个脚本成功打开浏览器并导航到谷歌。 .quit()
然后导致上面的崩溃,留下一个死的ChromeDriver实例。有什么可能导致这种情况,我该如何预防它?
研究发现了很多答案aren't quite relevant,overcomplicate things或claim it's an issue that was already fixed。
我给出了图片格式的相同输出。感谢您的帮助。 –