簡體   English   中英

raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException:消息:未知錯誤:找不到 Chrome 二進制文件

[英]raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

from selenium import webdriver from selenium.webdriver.common.keys import Keys導入時間

``PATH ="/home/j_a_r_v_i_s/Desktop/CODE/Email/chromedriver"

driver = webdriver.Chrome(PATH) driver.get("https://techwithtim.net")

search = driver.find_element_by_name("s") search.send_keys("hello") ``search.send_keys(Keys.RETURN)

``打印(驅動程序。標題)

這個錯誤

WebDriverException: Message: unknown error: cannot find Chrome binary 

您必須提供 chome 二進制文件的路徑

默認情況下, Chromedriver未安裝在您的系統中。 用戶必須單獨從ChromeDriver - WebDriver for Chrome 頁面下載 chromedriver,您可以將其放置在系統中的任何位置。

您必須確保 Chrome 安裝在最佳位置,因為服務器希望您根據以下快照將 Chrome 安裝在每個系統的默認位置:

在此處輸入圖像描述

然后您的代碼將如下所示,例如

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

options = Options()
options.binary_location = "C:\\Program Files\\Chrome\\chrome101.0.4951.67\\chrome.exe"
driver = webdriver.Chrome(chrome_options = options, executable_path=r'C:\path\to\chromedriver.exe')
driver.get('http://google.com/')
print("Chrome Browser Invoked")
driver.quit()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

相關問題 Selenium 在 Mac 上給出“selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary” Selenium.common.exceptions.WebDriverException:消息:未知錯誤:沒有 chrome 二進制文件 selenium.common.exceptions.WebDriverException:消息:未知錯誤:無法使用 OperaDriver Selenium 和 Python 找到 Opera 二進制文件 Python:引發exception_class(消息,屏幕,堆棧跟蹤)selenium.common.exceptions.UnexpectedAlertPresentException:警報文本:無消息: selenium.common.exceptions.WebDriverException:消息:未知錯誤:無法使用鎵和Docker殺死Chrome錯誤 selenium.common.exceptions.WebDriverException:消息:未知錯誤:無法在 localhost:8733 \\\\ 連接到 chrome 怎么回事? selenium.common.exceptions.WebDriverException:消息:未知錯誤:無法使用 ChromeDriver Chrome Selenium 創建 Chrome 進程錯誤 selenium.common.exceptions.WebDriverException:消息:未知錯誤:Chrome無法啟動:使用ChromeDriver Chrome和Selenium異常退出 selenium.common.exceptions.WebDriverException:消息:未知錯誤:無法使用帶有Selenium Python的ChromeDriver Chrome創建Chrome進程 selenium.common.exceptions.WebDriverException:消息:未知錯誤:Chrome無法以Selenium和RaspberryPi上的Chrome啟動
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM