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

使用Selenium 4.34.2加载未打包Chrome扩展不显示的问题求助

Selenium 4.34.2加载未打包Chrome扩展不显示的问题求助

大家好,我最近在做一个小脚本,想通过Selenium加载一个和脚本放在同一目录下的未打包Chrome扩展(文件夹名叫Pano-fetch),但遇到了个棘手的问题,想请各位大佬帮忙排查下!

先贴一下我的代码:

import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

unpacked_extension_path = 'Pano-fetch'
chrome_options = Options()
service = Service("/usr/bin/chromedriver")

chrome_options.add_argument('--load-extension={}'.format(unpacked_extension_path))
chrome_options.add_experimental_option("detach", True)

driver = webdriver.Chrome(service=service, options=chrome_options)
driver.get("https://www.google.com/maps")
time.sleep(10)

现在的情况是:脚本运行后能正常打开Chrome,我手动点击同意条款和条件后,Google Maps也能正常加载出来,但浏览器顶部的扩展栏里完全看不到我要加载的这个扩展图标,按道理它应该出现在那里才对。

我的环境配置:

  • Chrome版本:138.0.7204.100
  • 系统:Ubuntu 24.04
  • Selenium版本:4.34.2

有没有朋友遇到过类似的情况?或者能给我一些排查的方向?感激不尽!

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.07 12:39:31