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!!
To make Firefox work with Python selenium, you need to install the geckodriver. The geckodriver driver will start the real firefox browser and supports Javascript. Take a look at the selenium firefox code. First import the webdriver, then make it start firefox.
Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and allows you to record, edit, and debug tests.
WebDriver is a remote control interface that enables introspection and control of user agents. It provides a platform- and language-neutral wire protocol as a way for out-of-process programs to remotely instruct the behavior of web browsers.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With