Linux系统:selenium.common.exceptions.WebDriverException: Message: chrome not reachable

chromedriver版本匹配原理与Selenium启动失败根因解析 chromedriver并非Chrome插件,而是遵循W3C WebDriver协议的二进制翻译器,负责在Selenium与Chrome之间桥接指令与响应。其核心原理是三方语义对齐:Selenium发送标准API调用,chromedriver实时翻译为Chrome可执行的DevTools Protocol(CDP)命令,再回传执行结果。技术价值在于实现跨语言、跨平台的浏览器自动化控制,支撑Web UI测试、爬虫、RPA等关键场景。但该机制高度依赖Chrome、chromedriver、Selenium三者的 阅读详情

1.运行环境及版本

python:       Python3.6.5 | Anaconda
selenium:     3.14.0
chrome:       68.0.3440.84
chromedriver: 2.41

2.问题描述

测试selenium时输入如下代码:

>>> from selenium import webdriver
>>> browser = webdriver.Chrome()

报错信息如下:

    FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'
    selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. 
    Please see https://sites.google.com/a/chromium.org/chromedriver/home

解决:

将下载下来的谷歌浏览器驱动包chromedriver放到/usr/bin/目录下即可

验证:

>>> from selenium import webdriver
>>> browser = webdriver.Chrome()

可以弹出谷歌浏览器窗口,但是执行以下代码:

>>> from selenium import webdriver
>>> browser = webdriver.Chrome('https://www.baidu.com')
>>> print(browser.title)

报错信息如下:

    selenium.common.exceptions.WebDriverException: Message: chrome not reachable
    (Session info: chrome=68.0.3440.84)
    (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-29deepin-generic x86_64)

解决:

增加代码块:
    option = webdriver.ChromeOptions()
    options.add_argument('--headless')
    driver = webdriver.Chrome(chrome_options=option)

demo测试完整代码:

from selenium import webdriver
option = webdriver.ChromeOptions()
option.add_argument('--headless')
driver = webdriver.Chrome(chrome_options=option)
driver.get('https://www.baidu.com')
print(driver.title)

3.问题解决

Selenium Chrome启动失败与SyntaxError排查:Python自动化环境配置与调试指南 在Python自动化开发中,环境配置与语法调试是两大基础挑战。Selenium作为主流的Web自动化工具,其核心原理是通过WebDriver协议与浏览器进行通信,实现页面操控与数据抓取。这一技术的价值在于能够模拟用户操作,广泛应用于自动化测试、数据采集和RPA流程自动化等场景。然而,实践中常因环境配置不当引发ChromeDriver启动失败,同时代码语法错误也会导致脚本执行中断。本文聚焦于Chrome failed to start和SyntaxError这两个高频问题,从版本匹配、路径配置、无头模式等工程 阅读详情

相关推荐

汇编语言与接口技术(第4版)清华大学出版社 第2章 80*86微处理器 课后题答案

汇编语言与接口技术(第4版)清华大学出版社 第2章 80*86微处理器 课后题答案

m0_51658788的博客 3609

selenium.common.exceptions.WebDriverException: Message: chrome not reachable解决方法

【代码】selenium.common.exceptions.WebDriverException: Message: chrome not reachable解决方法。

bruceortt的博客 2827

CentOS7 安装天气分型软件cost733过程详解

cost733是一款天气分型软件,其内置的一些算法可以帮助气象工作者进行天气类型划分等(我也是初学者,仅仅知道一些皮毛),但是网上找到的安装办法比较少,并且总会出现一些报错,试了一晚上,终于将安装办法调通了,希望可以帮助到大家

weixin_62573024的博客 3564

解决Selenium无法启动的问题:WebDriverException: Message: chrome not reachable

上来先讲重点,如果出现这个问题,先检查两个地方: 和网上大多数的文章类似,先看你的hosts文件中localhost的指向 排查第一个问题之后,打开你的进程管理器,看看是不是有已经运行的chromedriver程序占用了端口 一般都是这两个问题造成的。下面是细节: 这两天,我也遇到了这个鬼魅的问题,因为我的自动化程序已经跑了好几个月了,在我没做任何修改的情况下,突然这几天我收不到通知短信...

点火三周的专栏 5万+

手把手教你用MATLAB/Simulink模拟微电网潮流方向(附代码下载)

本文提供了一份详细的MATLAB/Simulink微电网潮流仿真实战指南。通过手把手教学,指导读者从零搭建包含光伏、储能和负荷的微电网模型,并模拟并网、孤岛等多种运行场景下的潮流方向变化。文章核心在于利用Simulink实现微电网的动态潮流分析与可视化,帮助工程师深入理解分布式能源系统中的功率平衡与控制策略。

weixin_28314575的博客 108

A Mathematical Framework for Transformer Circuits—(二)

transformer数学理论框架

qq_42208244的博客 758

解决:selenium.common.exceptions.WebDriverException: Message: chrome not reachable

现象: 在使用selenium包驱动浏览器的时候,有的时候出现这样的错误: 看网上的解决方法比如: from selenium import webdriver option = webdriver.ChromeOptions() option.add_argument('--headless') driver = webdriver.Chrome(chrome_options=option) driver.get('http://www.baidu.com') 而我最终输出的是: 反正这里的中文我

wxl 1万+

Kriging代理模型理论相关推导

代理模型,Kriging,加点准则

森屹的博客 1万+

Centos 在 Selenium 使用中的异常:chrome not reachable

在使用 Selenium 进行数据处理的过程中,发现了一些问题: selenium.common.exceptions.WebDriverException: Message: chrome not reachable WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist 首先确认我们的 ChromeDriver 和已经安装的 Chromium的版本匹配没有问题 chromiu..

xuelangqingkong的专栏 4868

【附代码】SSVEP解码算法 - 扩展典型相关分析(eCCA)

本文主要对SSVEP解码算法-eCCA进行复现和测试。本文提供程序的所有代码,只要在Matlab上即可运行。读者可以根据程序自主调整,方便学习以及初学者更好地了解SSVEP的经典算法。

计算机小白 1337

在 ABAP CDS View 里把 Conversion Functions 用到极致:FLTP 精度、单位换算、货币换算与小数位处理的工程化实践

数据格式转换在真实项目中比业务逻辑更容易引发问题。ABAP CDS中的转换函数(如FLTP_TO_DEC、UNIT_CONVERSION、CURRENCY_CONVERSION和DECIMAL_SHIFT)可帮助在数据库层统一数据口径,避免应用层重复处理。这些函数支持数值精度治理、单位换算、货币转换和小数位调整,能显著提升报表性能并减少逻辑分散。通过将格式转换前移到数据模型层,可以确保服务层和UI层的数据一致性,同时降低接口传输错误风险。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 2353

'selenium.common.exceptions.WebDriverException: Message: u'chrome not reachable

import time from selenium import webdriver from xvfbwrapper import Xvfb vdisplay = Xvfb() vdisplay.start() from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_o...

qq_15256443的博客 994

模拟量输入功能块 S_ITR(Easy系列PLC完整ST源代码)

IN Input INT 输入数字量 1IN ISH INT 输入数字量上限 2IN ISL INT 输入数字量下限 3IN OSH REAL 输出工程量上限 4IN OSL REAL 输出工程量下限 5OUT OUTPUT REAL 输出工程量 6VAR temp1 REAL 临时变量1 7VAR temp2 REAL 临时变量2 8。

RXXW_Dor的博客 716

selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT

'chromedriver' 安装的代码分析: selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PAT

liulanba的博客 1万+

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Original error: chrome not reachable解决方法

在使用appium跑case时,从native切换到webview时报错Original error: chrome not reachable 查看appium日志发现这样一句话:Chromedriver v. 2.29.461591 does not fully support W3C protocol. Defaulting to MJSONWP 所以尝试换一个chromedriver试试, 下载最新版本的chromedriver:https://chromedriver.storage.goo

Apoor0052的博客 3290

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Appium自动化测试切换h5时报错chrome not reachable解决办法

使用driver.switch_to.context('WEBVIEW_com.wondershar')方法切换到H5页面时报错,error: No Chromedriver found that can automate Chrome '39.0.0'

软件测试小dao 829

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

关于:selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

selenium做ui自动化,启动浏览器就遇到了报错:selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary 有两种可能原因 没有chromedriver 没有找到chrome 解决方案:三个方式 方式1: 指定chromedriver.exe驱动绝对路径(也有可能你忘了在相关目录下放置chromedriver.exe,所以在做这个之前先看一下相关目录是否有ch

白骨梦儿 5424

解决Chromedriver报错Original error: chrome not reachable

切换webview时,提示:Original error: chrome not reachable。报以上错误,主要是由于缺少chromeOptions的配置,加上下面这段(三种方式选需要的即可)。java:ChromeOptions options = new ChromeOptions();options.setExperimentalOption("androidProcess", "co...

Tracy的博客 1万+

解决:selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ execu

运行爬虫代码出现上面的bug bug详细信息如下 D:\Anaconda3\file\envs\item\python.exe D:/pycharm/code/BadmintonCrawler.py D:\pycharm\code\BadmintonCrawler.py:22: DeprecationWarning: executable_path has been deprecated, please pass in a Service object driver = webdriver.Chr

tp_0moyi0的博客 2万+

WebDriverException: Message: ‘chromedriver‘ executable may have wrong permissions.

selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home 关于selenium的踩坑 出现这种问题,一般四种情况 1、没装chromedriver 直接安装,百度搜索,很多安装包,这里给一个吧,点击http://

spiderfu的博客 4795

selenium出错 selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs

错误信息为:selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home 1、这个时候需要访问这个网址下载webdr...

水月灯花的博客 1599

【解决方法】Appium 报错 Original error: chrome not reachable

背景 使用 Appium 做一些东西。 运行起来之后报错: An unknown server-side error occurred while processing the command. Original error: chrome not reachable 问题分析 我的控制脚本应该是没问题的,在自己的电脑上都跑的好好的,所以,一定是环境的问题。 从以下几处入手: 1、Chrome ...

Bottle's Blog 5万+

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

http://npm.taobao.org/mirrors/chromedriver/89.0.4389.23/ 1,到这个地址下载浏览器对应的浏览器驱动 2,将安装包解压 代码指定驱动路径webdriver.Chrome(r'E:\ChromeDriver\chromedriver.exe', chrome_options=chrome_options)

乱写乱画 446

出现错误selenium.common.exceptions.WebDriverException: Message: ‘chromedriver.exe‘ executable needs to b

用selenium爬取数据时发现出现错误, 在网上查询得知是chrome浏览器和chromedriver版本不匹配,于是打开cmd输入chromedriver看版本,打开浏览器关于chrome看其版本 在http://chromedriver.storage.googleapis.com/index.html上下载对应的chromedriver版本,替换原有。在anaconda安装文件夹和pycharm workspace中都替换了,但是cmd中chromedriver版本还是没变。最后找到C:\Use

qq_42041648的博客 489

解决selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

解决selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary问题 selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary报错 问题原因: 一般是因为chrome.exe或者是chromedriver.exe有问题 解决方法: 添加chr

weixin_54812545的博客 1707

selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’解决

selenium.common.exceptions.WebDriverException: Message: 'chromedriver’解决: https://blog.csdn.net/weixin_44318830/article/details/103339273 今天在做selenium测试的时候,可能是很久没用了,直接报了这个异常!         相信很多第一次学习selenium的同学们也对这个异常不陌生了,

古月哲亭 4319
上一篇: Hash函数及HashMap的简单介绍
下一篇: 使用scikit-learn进行初步的数据预处理
shmilygkd
博客等级 码龄10年 1粉丝 4原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值