6
votes

I've been trying to get my add-ons to work with my driver(driver as in webdriver.Firefox(profile)). I have no idea how to import (or if its optional at all) my regular Firefox profile. The one, i assume, contains all my add-ons.

Help is needed indeed.

Beside a solution (if available) an explanation to why my add-ons do not exist on the selenium webdriver could be a nice touch.

Thank very much!!

1

1 Answers

13
votes

If you do this, and set path_to_my_profile to where your usual profile resided, then Selenium should use your profile:

from selenium import webdriver
from selenium.webdriver.firefox.webdriver import FirefoxProfile

profile = FirefoxProfile(path_to_my_profile)
driver = webdriver.Firefox(profile)

I've not done this myself but I say this based on having read the code of Selenium. The reason Selenium does not use your profile by default is that by default a FirefoxProfile object is created with None as the first argument, which means "create a new profile for the Firefox instance we're about to launch".

By the way, what Selenium does by default (creating a new profile) is the best practice to ensure the repeatability of tests. It is a good thing.