简体   繁体   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 import time from selenium import webdriver from selenium.webdriver.common.keys import Keys导入时间

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

driver = webdriver.Chrome(PATH) driver.get("https://techwithtim.net") 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) search = driver.find_element_by_name("s") search.send_keys("hello") ``search.send_keys(Keys.RETURN)

``print(driver.title) ``打印(驱动程序。标题)

This error这个错误

WebDriverException: Message: unknown error: cannot find Chrome binary 

You have to provide the path for chome binary您必须提供 chome 二进制文件的路径

Chromedriver is not installed in your System by default.默认情况下, Chromedriver未安装在您的系统中。 Users individually have to download chromedriver from ChromeDriver - WebDriver for Chrome page and you can place it anywhere within your system.用户必须单独从ChromeDriver - WebDriver for Chrome 页面下载 chromedriver,您可以将其放置在系统中的任何位置。

You must ensure that Chrome is installed at the optimum location as the server expects you to have Chrome installed in the default location for each system as per the snapshot below :您必须确保 Chrome 安装在最佳位置,因为服务器希望您根据以下快照将 Chrome 安装在每个系统的默认位置:

在此处输入图像描述

Then your code will be look like, for example然后您的代码将如下所示,例如

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 gives "selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary" on Mac Selenium.common.exceptions.WebDriverException:消息:未知错误:没有 chrome 二进制文件 - Selenium.common.exceptions.WebDriverException: Message: unknown error: no chrome binary selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用 OperaDriver Selenium 和 Python 找到 Opera 二进制文件 - selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Opera binary with OperaDriver Selenium and Python Python:引发exception_class(消息,屏幕,堆栈跟踪)selenium.common.exceptions.UnexpectedAlertPresentException:警报文本:无消息: - Python: raise exception_class(message, screen, stacktrace) selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None Message: selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用镓和Docker杀死Chrome错误 - selenium.common.exceptions.WebDriverException: Message: unknown error: cannot kill Chrome error with gallium and Docker selenium.common.exceptions.WebDriverException:消息:未知错误:无法在 localhost:8733 \\\\ 连接到 chrome 怎么回事? - selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at localhost:8733 \\\\ What's going on? selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用 ChromeDriver Chrome Selenium 创建 Chrome 进程错误 - selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process error with ChromeDriver Chrome Selenium selenium.common.exceptions.WebDriverException:消息:未知错误:Chrome无法启动:使用ChromeDriver Chrome和Selenium异常退出 - selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用带有Selenium Python的ChromeDriver Chrome创建Chrome进程 - selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create Chrome process with ChromeDriver Chrome with Selenium Python selenium.common.exceptions.WebDriverException:消息:未知错误:Chrome无法以Selenium和RaspberryPi上的Chrome启动 - selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start with Selenium and Chrome on RaspberryPi
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM