Selenium遇到的問題2——下載了chromedriver,並放在Path目錄下,還是顯示錯誤
如下:
用Selenium打開谷歌瀏覽器(版本59),需要對應的chromedriver,
我下載了對應的chromedriver 2.30版本,我放在了Python目錄下,確保已經在Path路徑中。
網上看了一堆解決方案,說要把chromedriver放在Path路徑在
還有下面這種:
- from selenium import webdriver
- chromedriver = r"C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome"
- driver = webdriver.Chrome(chromedriver)
- driver.get("http://www.baidu.com")
都不行
然後用了另一個chromedriver 2.32版本的,也是放在Python 路徑在,就可以了。
原因應該是之前的2.30版本的chromedriver.exe的名字是chromedriver2.30,多了後面的版本號;後面的2.32版本沒有顯示版本號,直接是chromedriver