我正在使用 Selenium 编写程序,但找不到 Web 驱动程序。我将它的路径添加到路径变量中,尝试在代码本身中指定驱动程序的路径,但仍然显示错误。
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH.
如何解决这个问题?
我正在使用 Selenium 编写程序,但找不到 Web 驱动程序。我将它的路径添加到路径变量中,尝试在代码本身中指定驱动程序的路径,但仍然显示错误。
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH.
如何解决这个问题?
您可以在代码中明确指定路径。不需要添加到 PATH。例如:
这是针对 Linux 的。也就是说,这里是chromedriver文件夹中的chromedriver,在脚本所在的目录中。
好吧,或者相同,但对于 Windows: