I tried the recommended method of loading a profile, but it's not working for me. It simply opens an empty profile.
from selenium.webdriver import Firefox
from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options
profile_path = r'E:/Python/seleniumProfile'
options=Options()
options.set_preference('profile', profile_path)
driver = Firefox(options=options)
driver.get("https://www.google.com")
No warning or error message is given, even if I type an invalid folder as the profile_path.
Old way works great, but gives the deprecation warning:
fp = webdriver.FirefoxProfile('E:/Python/seleniumProfile')
driver = webdriver.Firefox(fp)
driver.get("https://www.google.com")
DeprecationWarning: firefox_profile has been deprecated, please use an Options object
I guess I can live with the warnings, but any help would be appreciated.
This error message...
...implies that usage of
FirefoxProfile()
have been Deprecated and with selenium4 and to use a custom profile you have to use an instance ofOptions
. This DeprecationWarning was inline with the following CHANGELOGS:Selenium 4 beta 1
Options
andService
arguments in driver instantiation. (#9125,#9128)Selenium 4 beta 2
Selenium 4 Beta 3
Solution
To use an existing firefox profile you can use the following solution:
tl; dr
Setting a custom profile