使用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
相关产品推荐
相关产品推荐

