提问人:Dias Zhumagaliyev 提问时间:6/1/2020 更新时间:6/1/2020 访问量:101
无法运行测试脚本。PyCharm Selenium Python 测试 [复制]
Cant run testing script. PyCharm Selenium Python Testing [duplicate]
问:
我可以运行脚本进行自动测试。
这是脚本
from selenium import webdriver
PATH = "Z:\PyProjects\venv\Scripts\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get("https://google.com/")
这是我运行脚本后遇到的错误
Z:\PyProjects\venv\Scripts\python.exe Z:/PyProjects/test.py
Traceback (most recent call last):
File "Z:\PyProjects\venv\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Python38\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Python38\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] unable to find the file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Z:/PyProjects/test.py", line 3, in <module>
driver = webdriver.Chrome(PATH)
File "Z:\PyProjects\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "Z:\PyProjects\venv\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Process finished with exit code 1
答: 暂无答案
评论