Multiple Browser Contexts using CDP

176 views
Skip to first unread message

Mor Amrani

unread,
Dec 4, 2022, 8:39:34 AM12/4/22
to devtools-dev
Hello,

Is there a way to create multiple persistent profiles/Browser Contexts using CDP?
Target.createBrowserContext method description indicates that the new browser context is similar to an Incognito one and this is well represented by the code:


Is there a reason for not using regular profiles?
Is there a plan to support this?

Thanks,
Mor

Paul Irish

unread,
Dec 5, 2022, 4:07:59 PM12/5/22
to Mor Amrani, devtools-dev
You can use existing profile folders using --profile-directory (assuming --user-data-dir also points somewhere existing). More: https://github.com/GoogleChrome/chrome-launcher/issues/172#issuecomment-555277231

AFAIK you cannot create/select Chrome profiles over CDP.

This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.

--
You received this message because you are subscribed to the Google Groups "devtools-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to devtools-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/devtools-dev/a951f686-bf44-455f-83f5-f151f9060de5n%40chromium.org.

Mor Amrani

unread,
Dec 13, 2022, 4:31:23 AM12/13/22
to devtools-dev, Paul, devtools-dev, Mor Amrani
Thank you Paul, this is very helpful!

I have managed to use multiple profiles with the same browser process when running headful. However, this doesn't work for me when running headless.
Is it fair to say that the browser must be launched in headful mode in order to use the --profile-directory option?

Reply all
Reply to author
Forward
0 new messages