程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python+selenium reports an error due to the version problem when using the chrome drive

編輯:Python

stay webdriver function Chrome The following error is reported when the drive is running , Because Chrome The version of the drive does not support the current Chrome Version of ( Generally, it is upgraded manually or automatically Chrome Browser version ).

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 88
 

To solve such a problem , There are two ways :

Method 1 :

Download from official website chromedriver Supported by Chrome Browser version , The biggest drawback of this method is that it misses the compatibility problem ( Abreast of the times Chrome Whether the browser version will be compatible with the product ).Chrome There is no official offer to download the old version , Here are some other sources , You can find it by yourself .

Chrome Old version download

Method 2 :

Download support current Chrome Browser version of chromedriver, The link is attached below :

chromedriver download

Downloaded chromedriver There are two ways to use :

1, Directly into the installed python Under the path

2, In the use of web.Chrome() When , Appoint chromewebdriver The address of , This method is more recommended in the project .

from selenium import webdriver
chromeDriverPath='E:\Tool\Python-3.8.2\chromedriver.exe' #chromedriver.exe Where it is
driver = webdriver.Chrome(executable_path=chromeDriverPath)
driver.get('http://www.baidu.com')
print('Open success!')


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved