溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

解決webdriver.Chrome()報錯:Message:'chromedriver' executable needs to be in Path

發(fā)布時間:2020-10-06 01:20:17 來源:腳本之家 閱讀:234 作者:繁華里流浪 欄目:開發(fā)技術(shù)

'chromedriver' executable needs to be in Path

聲明:本人萌新,剛學python不久記錄一下自己的坑,發(fā)出來若能幫助到一些人盡早解決問題那便是極好的,( ̄▽ ̄)"

在進行爬蟲爬取淘寶商品信息時候,利用selenium來模擬瀏覽器進行爬取時遇到了這個問題:

selenium.common.exception.WebDriverException:Message:'chromedriver' executable needs to be in Path

詳細如下圖所示:

解決webdriver.Chrome()報錯:Message:'chromedriver' executable needs to be in Path

這一錯誤是因為沒有配置好chromedriver,怎么配置呢?(我用的是chrome)

1.打開chrome 輸入 “chrome://version/”來查看chrome版本 如圖我的是63

解決webdriver.Chrome()報錯:Message:'chromedriver' executable needs to be in Path

2.訪問此網(wǎng)站 http://chromedriver.storage.googleapis.com/index.html 然后選擇合適版本的driver

比如

解決webdriver.Chrome()報錯:Message:'chromedriver' executable needs to be in Path

點擊notes.txt就可查看其對應的版本號,如下:

解決webdriver.Chrome()報錯:Message:'chromedriver' executable needs to be in Path

如果符合就可以下載了,下載到自己指定位置然后就可以進行配置了

3. 配置如下:

解決webdriver.Chrome()報錯:Message:'chromedriver' executable needs to be in Path

(具體路徑根據(jù)自己下載保存的位置而定)

4.這時候運行基本就可以成功了!

不過很不幸,我第一次瞎下的driver版本不對,所以就GG了拋出了如下錯誤 ConnectionResetError:主機強迫關閉了一個現(xiàn)有連接

解決webdriver.Chrome()報錯:Message:'chromedriver' executable needs to be in Path

于是乎重新下了一個匹配的driver版本然后ok了

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持億速云。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI