How to use Selenium to install Firefox browser add-on?

182 Views Asked by At

I would like to use Selenium to install an add-on to my Firefox browser. Specifically, I have an add-on called "nopecha" that I would like to install.

Could you kindly guide me on how to accomplish this task?

1

There are 1 best solutions below

0
Andreas Violaris On

To add NopeCHA to Firefox using Selenium, you can use the following code:

from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from webdriver_manager.firefox import GeckoDriverManager

driver = webdriver.Firefox(service=Service(GeckoDriverManager().install()))
driver.install_addon("nopecha.xpi")

Make sure to replace nopecha.xpi with the actual file path of the NopeCHA extension on your system.

However, there is no need to install this specific add-on manually using Selenium, since an official NopeCHA Python library is available.