1、下載谷歌驅動:chromedriver.exe
http://chromedriver.storage.googleapis.com/index.html (下載驅動的鏈接)
2、把下載的chromedriver.exe 放到 C:\Programs\Python\Python36 這個下面
(注意:把這個目錄添加到環境變量中,如果有python的環境變量了就可以不用添加了,因為他們是同一個路徑)
3、代碼測試
from selenium import webdriver at = webdriver.Chrome() diver = at.get('https://www.baidu.com/')
備注:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
(Session info: chrome=79.0.3945.79)
# 這個問題不是版本對不上,僅僅是因為url沒有寫協議名稱