How to use an existing Firefox profile with Selenium 4 and Python

438 views
Skip to first unread message

Tissi_2

unread,
Mar 13, 2022, 6:32:55 PM3/13/22
to Selenium Users
Hi everybody!

What is the right syntax to use an existing Firefox profile? This is what I got so far:

options= Options()
FirefoxBinary = 'C:/Program Files/Mozilla Firefox/firefox.exe'
FirefoxProfile = 'C:/Users/Tissi/AppData/Roaming/Mozilla/Firefox/Profiles/xx513scw.Selenium_Test'
service = Service(r'C:\Python310x64\geckodriver')
driver = webdriver.Firefox(service=service, options=options)

It runs, but in the existing profile I have a chrome folder with userChrome.css. that prevents the top bar to appear when hovering the mouse pointer at the top of the browser window.

I see that the geckodriver creates a rust_profile in the temp folder, but the created chrome folder with my userChrome.css is missing. I think that my syntax is not right.

Any ideas?
Best regards

Nortier David

unread,
Mar 14, 2022, 3:41:45 AM3/14/22
to seleniu...@googlegroups.com

Hello

 

Have you try with private navigation ? (perhaps)

 

Exemple with edge in c#:

 

var edgeOptions = new EdgeOptions

                {

                    UseChromium = true,

                };

                if (privateNav)

                {

                    edgeOptions.AddArgument("inprivate");

                }

 

 

Hope this helps

 

De : 'Tissi_2' via Selenium Users <seleniu...@googlegroups.com>
Envoyé : dimanche 13 mars 2022 16:41
À : Selenium Users <seleniu...@googlegroups.com>
Objet : [selenium-users] How to use an existing Firefox profile with Selenium 4 and Python

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/775a3134-3525-4dd5-8c13-f4587b6c1503n%40googlegroups.com.


====== DISCLAIMER ======

https://www.cph.be/maildisclaimer

Tissi_2

unread,
Mar 14, 2022, 5:05:47 PM3/14/22
to Selenium Users
Thanks for your idea! I would like to stick to python and Firefox, and I think that the bold lines only takes care of not saving any data that was created/loaded while browsing.
Reply all
Reply to author
Forward
0 new messages