1、下载chromedriver
chromedriver下载网址:CNPM Binaries Mirror
老版本在:chromedriver/
较新版本在:chrome-for-testing/
2、设置了环境变量还是找不到chromedriverUnable to obtain driver for chrome using
NoSuchDriverException: Message: Unable to obtain driver for chrome using Selenium Manager
方法:
第一种:chromedriver.exe复制文件放入python安装目录的Scripts文件夹中
例如:C:\Users\***\AppData\Local\Programs\Python\Python38\Scripts文章来源:https://www.toymoban.com/news/detail-860520.html
第二种:带上路径执行文章来源地址https://www.toymoban.com/news/detail-860520.html
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
# Add service
service = Service(executable_path=r"C:\Users\***\chromedriver.exe")
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
driver.get('https://www.baidu.com')
driver.quit()
到了这里,关于chromedriverUnable to obtain driver for chrome using ,selenium找不到chromedriver的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!