selenium.common.exceptions.WebDriverException: Message: unknown Error: cannot find Chrome binary


使用Chrome瀏覽器時,經常會遇到以下報錯:瀏覽器沒有調用起來

selenium.common.exceptions.WebDriverException: Message: unknown Error: cannot find Chrome binary

通常由兩種問題引起的:

1.ChromeDriver.exe驅動有問題(包括版本,路徑等等)

2.Chrome.exe本身有問題。

 

解決方案:三個

1.指定chromedriver.exe驅動絕對路徑

    driver = webdriver.Chrome(r'd:\xxx\chromedriver.exe')

2.添加chrome.exe到系統path環境變量

3.在代碼中指定chrome.exe絕對路徑。設置binary_location屬性

    option = webdriver.ChromeOptions() option.binary_location=r'C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe' driver = webdriver.Chrome() driver.get('https://www.baidu.com')

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM