selenium调用谷歌浏览器失败

错误信息:selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

解决方法:

from selenium import webdriver

option = webdriver.ChromeOptions()

# 绝对地址
option.binary_location = 'C:\Program Files\Google\Chrome\Application\chrome.exe'
driver = webdriver.Chrome(chrome_options=option)
driver.get('https://www.baidu.com')

posted @ 2021-06-29 11:33  布都御魂  阅读(284)  评论(0编辑  收藏  举报