测试积点老人 发表于 2021-11-29 09:28:08

使用selenium+chrome+webdriver,驱动是出现异常

第一次进行测试,用selenium控制打开chrome结果报错,不知道如何解决,请求解决办法

>>> driver=webdriver.Chrome()
Traceback (most recent call last):
File "C:\python3\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
    self.process = subprocess.Popen(cmd, env=self.env,
File "C:\python3\lib\subprocess.py", line 832, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\python3\lib\subprocess.py", line 1294, in _get_handles
    c2pwrite = msvcrt.get_osfhandle(self._get_devnull())
File "C:\python3\lib\subprocess.py", line 1077, in _get_devnull
    self._devnull = os.open(os.devnull, os.O_RDWR)
FileNotFoundError: No such file or directory: 'nul'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\python3\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\python3\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 90, in __init__
    self.service.start()
File "C:\python3\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

海海豚 发表于 2021-11-30 09:14:20

chromedriver需要放在正确的路径下

qqq911 发表于 2021-11-30 10:20:27

添加下环境变量

jingzizx 发表于 2021-11-30 17:33:12

配置
页: [1]
查看完整版本: 使用selenium+chrome+webdriver,驱动是出现异常