WebDriverException: Message: unknown error: cannot find Chrome binary解决方法

python3-conda

【直接手动运行chromedriver.exe,保证和chrome的版本好一致】


附上,直接代码写死就可以解决报错误问题:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.binary_location = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
driver = webdriver.Chrome(options = options, executable_path="D:\\Program Files (x86)\\webdriver\\chromedriver_win32\\chromedriver.exe")
driver.get('http://data.eastmoney.com/bbsj/201806/lrb.html')
print("Chrome Browser Invoked")
#driver.quit()


另外,我之前的错误为:

options.binary_location = r"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
应该为

options.binary_location = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
 

你可能感兴趣的:(chrome,前端,开发语言,python)