Flu_Py Developer
Flu_Py Developer

Reputation: 231

How to open multiple chrome profiles with selenium at same time?

I am trying to open multiple windows with different profiles, tried:

options.add_argument(f"--user-data-dir={expanduser}\\AppData\\Local\\Google\\Chrome\\User Data\\")
options.add_argument(f"profile-directory={profile}")

but this just switched the profiles, so it is on the same path, and if I tried to run it multiple times, it gives me this error : user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir

Upvotes: 2

Views: 867

Answers (1)

Flu_Py Developer
Flu_Py Developer

Reputation: 231

The only way I found was to create a whole new User Data Directory:

options.add_argument(f"--user-data-dir={expanduser}\\AppData\\Local\\Google\\Chrome\\{random_name}\\")

this will create a full new chrome, not just a profile.

Upvotes: 3

Related Questions