繁体   English   中英

如何在 geckodriver 中加载扩展 selenium python

[英]How to load extension in geckodriver selenium python

我想在 firefox 驱动程序中加载扩展程序(zenmate VPN),我使用了这段代码,驱动程序打开但扩展程序没有加载到驱动程序中。

from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.add_extension(extension='D:\\vpn\\xpi\\zenmate.xpi')
driver = webdriver.Firefox(executable_path='D:\\firefox.exe',firefox_profile=profile)

我搜索了我的代码的问题,但找不到好的答案。

如果你有加载扩展的 Firefox 配置文件,你可以通过

fp = webdriver.FirefoxProfile('/Users/<username>/Library/Application Support/Firefox/Profiles/71v1uczn.default')
driver = webdriver.Firefox(executable_path='D:\\firefox.exe',firefox_profile=fp)

您需要使用加载扩展的配置文件更改71v1uczn.default

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM