2

I'm trying to load a FirefoxProfile with selenium in Python, in order to make use of a persistent login cookie.

profile = webdriver.FirefoxProfile(profile_directory='~/.mozilla/firefox/gu16idx8.default/')
driver = webdriver.Firefox(profile)

The frist line above throws this error:

FileNotFoundError: [Errno 2] No such file or directory: '~/.mozilla/firefox/gu16idx8.default/'

Even though the file does exist (verified with cd ~/.mozilla/firefox/gu16idx8.default/)

Any thoughts?

whenitrains
  • 468
  • 5
  • 21

1 Answers1

1

Try with os.path.expanduser

profile = webdriver.FirefoxProfile(os.path.expanduser("~/.mozilla/firefox/gu16idx8.default/"))
driver = webdriver.Firefox(profile)
Infern0
  • 2,565
  • 1
  • 8
  • 21