1

Okay so I wasted a whole day self research and failed. So help? I made a profile and all I'm trying to do is open Firefox under that profile as and have it set as a default.

Here is the code

from selenium import webdriver from selenium.webdriver.firefox.options import Options from selenium.webdriver.firefox.firefox_binary import FirefoxBinary ff_options = Options() #profile binary = FirefoxBinary("C:\\Program Files\\Mozilla Firefox\\firefox.exe") profile = webdriver.FirefoxProfile('C:\\Users\\bravoj\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\7k4o5psw.CCC Deafualt') ff_driver = webdriver.Firefox(firefox_profile=profile, firefox_binary=binary, executable_path='C:\\Users\\bravoj\Downloads\\geckodriver.exe') #fire fox driver ff_driver.get('about:profiles') 
2
  • Could you mention which version of Firefox browser and webdriver driver you are using? Commented Nov 20, 2019 at 4:17
  • 1
    @KiranAntony its 70.0.1 Commented Nov 20, 2019 at 5:18

1 Answer 1

0

Selenium indeed uses a copy of the profile, though that ought not to cause any problems. I think your issue has more to do with session cookies vs. persistent cookies.

On support.mozilla.org is a list indicating what information is actually stored in your profile. Note that cookies are among these, however session-cookies are not stored in cookies.sqlite which is the reason Selenium cannot rebuild your session since it does not appear in the profile.

Many sites, however, offer a remember-me or a stay-logged-in option on their login page which, if used, will store a persistent cookie by which the session can be restored. I used the following script to test this out with gmail,

from selenium import webdriver url = "https://mail.google.com" fp = webdriver.FirefoxProfile('/Users/<username>/Library/Application Support/Firefox/Profiles/71v1uczn.default') driver = webdriver.Firefox(fp) driver.get(url) 
Sign up to request clarification or add additional context in comments.

4 Comments

I ended up copying your code and only changing the directory of the profile to mine. I got the error that I need the gecko driver, i'm assuming it wont work without it? I was hoping to actually open up the actual browser instead of the testing environment.
Giving "default" in the profiling should open the real browser
I'm so sorry, I'm still new and have only been doping this for 5 days. but could I get an example? because I changed the the profile to the default profile and still didn't work.
from selenium import webdriver url = "<targeted website>" fp = webdriver.FirefoxProfile('C:\\Users\\<admin>\\AppData\\Local\\Mozilla\\Firefox\\Profiles\\t18zcb43.default') driver = webdriver.Firefox(fp) driver.get(url)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.