You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Chrome 127+版本下Selenium禁用搜索引擎选择界面及驱动报错解决

解决方案

要解决Chrome 127版本后出现的搜索引擎选择界面阻塞问题,同时修复NoSuchDriverException错误,你需要在现有代码中添加Chrome启动参数,并确保驱动版本与浏览器匹配,具体修改如下:

关键修改点

  • 导入ChromeOptions类配置浏览器启动参数
  • 添加--disable-search-engine-choice-screen参数,直接跳过搜索引擎选择界面
  • 确保chromedriver版本与你的Chrome 127.0.6533.72完全匹配,避免驱动不兼容错误

修改后的完整代码

import time
from parsel import Selector
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
# 新增导入ChromeOptions类
from selenium.webdriver.chrome.options import Options

class Test:

    def __init__(self):
        self.email = Test.email
        self.password = Test.password
        self.searchs = Test.searchs
        self.base_domain = "https://www.test.com"
        
        # 配置Chrome启动参数
        chrome_options = Options()
        # 添加跳过搜索引擎选择界面的参数
        chrome_options.add_argument("--disable-search-engine-choice-screen")
        
        self.s = Service('./chromedriver')
        # 将配置好的options传入浏览器实例
        self.driver = webdriver.Chrome(service=self.s, options=chrome_options)

额外注意事项

若仍出现NoSuchDriverException,请检查:

  • ./chromedriver路径是否正确,可替换为绝对路径(如C:/chromedriver.exe或/usr/local/bin/chromedriver)
  • 下载的chromedriver版本必须与Chrome 127.0.6533.72完全对应

内容的提问来源于stack exchange,提问作者Aliot

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 07:15:59