selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH


無法運行時候:

selenium使用Chrome時報錯:

selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

1、進入頁面

https://sites.google.com/a/chromium.org/chromedriver/home


2、選擇合適的Chrome版本下載

 

3、解壓下的Chromedriver放到python安裝的目錄下,

 

4、運行測試

from selenium import webdriver                     # 從selenium導入webdriver

driver = webdriver.Chrome()                          # Optional argument, if not specified will search path.
driver.get('https://www.baidu.com')                # 獲取百度頁面

可以了,之前測試了好幾次,安裝其他目錄加到環境變量還是不行,后來放到python安裝目錄下就好了。
————————————————
版權聲明:本文為CSDN博主「奮斗吧-皮卡丘」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/weixin_42081389/article/details/88046681


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM