转自:https://www.cnblogs.com/yoyoketang/p/6789537.html?utm_source=itdadao&utm_medium=referral
chromedriver下载页:http://chromedriver.storage.googleapis.com/index.html
本人随便点击下载了个chromedriver,然后python运行Selenium报错
from selenium import webdriver
# from selenium.webdriver.chrome.options import Options
# chrome_options = Options()
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
driver = webdriver.Chrome(chrome_options=chrome_options,executable_path="D:\\开发\chromedriver_win32\\chromedriver")
driver.get("https://s.taobao.com/search/?")
driver.get_screenshot_as_file("C:\\Users\\Administrator\\Desktop\\test.png")
driver.close()
执行谷歌浏览器弹出报错
原因是chromedriver的版本和本机安装的chrome版本对不上
查看chrome版本号-》设置-》关于
chrome版本是66,因为谷歌浏览器是最新版本,所以我也去重新下载最新版本的chromedriver
chromedriver2.38是最新的版本,下载后,解压重新运行selenium,一切正常