阅读量:0
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
第二种:带上路径执行
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()