我在代理服務器後面。使用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。
我給出了圖片格式的相同輸出。感謝您的幫助。 –