ConnectionResetError: [WinError 10054] 远程主机强迫关闭了

利用python selenium 搞自动化测试  在打开Google浏览器时抛出这个异常 


C:\Users\think\AppData\Local\Programs\Python\Python35\python.exe F:/Python/test.py
Traceback (most recent call last):
  File "F:/Python/test.py", line 7, in
    browser.get("http://www.yahoo.com") # Load page
  File "C:\Users\think\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 268, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\think\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 254, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Users\think\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 464, in execute
    return self._request(command_info[0], url, body=data)
  File "C:\Users\think\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 488, in _request
    resp = self._conn.getresponse()
  File "C:\Users\think\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 1174, in getresponse
    response.begin()
  File "C:\Users\think\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 282, in begin
    version, status, reason = self._read_status()
  File "C:\Users\think\AppData\Local\Programs\Python\Python35\lib\http\client.py", line 243, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\think\AppData\Local\Programs\Python\Python35\lib\socket.py", line 571, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。


需要下载最新版本的chromedriver.exe,比如 2.27,就可以正常打开了。

你可能感兴趣的:(python)