【发布时间】:2018-04-04 07:05:32
【问题描述】:
当尝试使用 IE 运行 Selenium Webdriver 测试时,浏览器会启动,但会立即崩溃并出现错误“IE 驱动程序的命令行服务器已停止工作”。
- IE 失败的脚本在 Chrome 和 Firefox 中运行良好。
- Windows 10 IE 11.15.16299.0
- Python 3.6.3(与 Python 2.7.14 一起试用)
- 32 位 IEDriverServer.exe 版本 3.5.0.0
- 我按照安装说明操作 https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
以下是 Python 报告的内容:
Traceback (most recent call last):
File "tc_131.py", line 34, in <module>
driver.set_page_load_timeout(30)
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 814, in set_page_load_timeout
'pageLoad': int(float(time_to_wait) * 1000)})
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 306, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\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\brent\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 526, in _request
resp = opener.open(request, timeout=self._timeout)
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 526, in open
response = self._open(req, data)
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 544, in _open
'_open', req)
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 1321, in do_open
r = h.getresponse()
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 1331, in getresponse
response.begin()
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\http\client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Users\brent\AppData\Local\Programs\Python\Python36-32\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
最简单的测试导致失败:
from selenium import webdriver
driver = webdriver.Ie()
driver.set_page_load_timeout(30)
driver.get('https://google.com')
driver.implicitly_wait(30)
【问题讨论】:
-
你能分享你的完整测试吗?
-
添加了导致失败的简单测试的文本。
标签: selenium internet-explorer webdriver