How to save firefox profiles to a folder using selenium and python

377 Views Asked by At

When i load a firefox profile into a selenium webdriver like this:

fp = webdriver.FirefoxProfile('c:/profile_folder_path')
driver = webdriver.Firefox(executable_path='geckodriver.exe', firefox_profile=fp)

it loads the profile fine and it works. But in situation where you pass an empty folder to FirefoxProfile() like:

fp = webdriver.FirefoxProfile('c:/empty_path')
driver = webdriver.Firefox(executable_path='geckodriver.exe', firefox_profile=fp)

it doesn't create a new profile like chrome, edge and opera.

On Chrome

options = Options()
# This will save a new profile to the path if a profile is not there
options.add_argument(f'--user-data-dir="C:/empty_path"')

It also works on Edge and Opera.

Why doesn't it work on firefox and is there any way of achieving this?

0

There are 0 best solutions below