51Testing软件测试论坛
标题:
运行的时候.py,报错
[打印本页]
作者:
桔梗花开
时间:
2017-12-7 13:15
标题:
运行的时候.py,报错
文件为:
# coding=utf-8
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://www.baidu.com/")
driver.find_element_by_id("kw").send_keys("Selenium2")
driver.find_element_by_id("su").click()
driver.quit()
运行的时候:
>>>
=== RESTART: C:\Users\www\AppData\Local\Programs\Python\Python36\baidu.py ===
Traceback (most recent call last):
File "C:\Users\www\AppData\Local\Programs\Python\Python36\baidu.py", line 4, in <module>
driver = webdriver.Firefox()
File "C:\Users\www\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 148, in __init__
self.service.start()
File "C:\Users\www\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\www\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 667, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Users\www\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 905, in _get_handles
p2cread = self._make_inheritable(p2cread)
File "C:\Users\www\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 955, in _make_inheritable
_winapi.DUPLICATE_SAME_ACCESS)
OSError: [WinError 6] 句柄无效。
运行文件的时候,报错 句柄无效
作者:
本才
时间:
2017-12-7 14:10
Webdriver 的驱动安装有误,selenium3 是要额外安装Firefox webdriver 的。
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2