0

Im trying to open a new Chrome browser that is already logged into my main Chrome account on Python using Selenium.

However, I can only seem to open a browser that is on a guest account.

from selenium import webdriver
#object of ChromeOptions class
o = webdriver.ChromeOptions()
#adding Chrome Profile Path
o.add_argument = {'user-data-dir':'/Users/jamessstuff/Library/Application Support/Google/Chrome/Default'}
#set chromedriver.exe path
driver = webdriver.Chrome(executable_path="/Users/jamessstuff/Desktop/chromedriver", options=o)
James
  • 19
  • 5

1 Answers1

1

I don't think it is possible to start a page through selenium that has already been logged in. The only way is to automate the login process.

To do that you need create a script that can login with your credentials. Make sure to leave a 5s delay after each action [like typing your password] to workaround the fact that you are using automated software.

However, if you are logging into a website like StackOverflow.com, then you can use Pickle to save cookies as a text file and load it each time you run the script. This way, you won't have to login each time!

Here's the reference to Pickle:

https://docs.python.org/3/library/pickle.html