Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch Chromium with a specific profile #122

Open
emyann opened this issue Apr 2, 2025 · 2 comments
Open

Launch Chromium with a specific profile #122

emyann opened this issue Apr 2, 2025 · 2 comments

Comments

@emyann
Copy link

emyann commented Apr 2, 2025

I've seen that --user-data-dir has been recently supported, thanks a lot for that! 🎉

On Playwright's documentation I see that we can pass browser's custom args, allowing to use --profile-directory on Chromium to target a specific profile. I've been through the code but I don't think it is supported yet, am I right?

The reason I'm looking for that feature is that I would like to avoid to mess with my main profile, and have a configured profile for automation purposes.

Please let me know whether this makes sense or not 🙏🏽

@pavelfeldman
Copy link
Member

Sounds like the behavior you desire is what already happens by default if no flags are passed. See https://github.com/microsoft/playwright-mcp?tab=readme-ov-file#user-data-directory. By default you get a dedicated profile for automation that is different from your regular browsing profile.

@emyann
Copy link
Author

emyann commented Apr 3, 2025

Thanks for the quick reply @pavelfeldman 🙏🏽

You're totally right that Playwright creates a dedicated automation profile by default when no flags are passed, and that behavior works well for many cases.

However, my use case is a bit different — I’m trying to reuse a preconfigured profile, one that already includes things like session cookies and account logins (e.g., Gmail), so I can automate tasks within that environment.

Right now, starting from a clean state makes it difficult to create and maintain a usable profile through automation. For example:

When I try to authenticate to Gmail, the browser is flagged as automated and blocked by Google.

Because of this, I can’t configure the profile via Playwright itself — I’d need to configure it manually via regular Chromium, then point Playwright to it.

But without support for --profile-directory, I can't target that manually created profile reliably inside the user data directory.

So essentially, the lack of --profile-directory support makes it hard to reuse a named, preconfigured, and functional profile that was created outside of Playwright for automation purposes.

Would love to hear your thoughts or know if there's a recommended workaround for this kind of setup 🙏🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants