出现selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary的报错:
问题原因:
一般是因为chrome.exe或者是chromedriver.exe有问题
解决方法:
添加chrome.exe还有chromedriver.exe的绝对路径
from selenium import webdriver
option = webdriver.ChromeOptions()
option.binary_location = r'D:\Google chrome\Google\Chrome\Application\chrome.exe'
driver = webdriver.Chrome(r'D:\Google chrome\Google\Chrome\Application\chromedriver.exe')
driver.get("http://www.baidu.com")
重新运行下代码,问题解决,Google浏览器自动打开了