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')
Kiran Antony
  • 190
  • 1
  • 15
Jbravo
  • 43
  • 6

1 Answers1

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)
Kiran Antony
  • 190
  • 1
  • 15
  • 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. – Jbravo Nov 20 '19 at 05:52
  • Giving "default" in the profiling should open the real browser – Kiran Antony Nov 20 '19 at 05:57
  • 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. – Jbravo Nov 20 '19 at 06:25
  • from selenium import webdriver url = "" fp = webdriver.FirefoxProfile('C:\\Users\\\\AppData\\Local\\Mozilla\\Firefox\\Profiles\\t18zcb43.default') driver = webdriver.Firefox(fp) driver.get(url) – Jbravo Nov 20 '19 at 06:26