python3.6中使用selenium + chromedriver访问Chrome浏览器时报错

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
 
if __name__ == '__main__':
    chrome_options = Options()
    chrome_options.add_argument('--headless')
    chrome_options.add_argument('--disable-gpu')
    driver_path = 'E:Program Files (x86)pythonScriptschromedriver.exe'    #这里放的就是下载的chromedriver本地路径
    driver = webdriver.Chrome(chrome_options=chrome_options, executable_path = driver_path)
    driver.get('https://www.toutiao.com/ch/news_tech/')
    driver.quit()

下面是报错信息:

这里的错误信息就是chrome浏览器的版本与chromediver的版本不一致造成的

解决办法就是找到与你电脑chrome浏览器对应的chromediver就可以解决这个问题了,

我们进入到chromedriver的下载地址:http://npm.taobao.org/mirrors/chromedriver

网页的内容如下图:

我们随便进入一个目录找到这个文件打开:

我们就可以找到版本之间的对应关系了

原文地址:https://www.cnblogs.com/2016-10-07/p/9441498.html