Skip to content

[Feature]: Please allow playwright codegen to launch the browser in normal mode instead of InPrivate/Incognito mode #35617

@johnnyqian

Description

@johnnyqian

🚀 Feature Request

Please allow playwright codegen to launch the browser in normal mode instead of InPrivate/Incognito mode. Some websites cannot login in this mode. Especially sites that are using Azure AD, they require an active user profile which InPrivate/Incognito mode can't offer.

Example

No response

Motivation

To make the playwright codegen available in more scenarios.

Activity

agg23

agg23 commented on Apr 28, 2025

@agg23
Contributor

Duplicate #34797

mxschmitt

mxschmitt commented on Apr 28, 2025

@mxschmitt
Member
johnnyqian

johnnyqian commented on May 6, 2025

@johnnyqian
Author

I prefer not using code snippet. What I expected is as follows:

npx playwright codegen --browser=chromium --channel=msedge --inprivate=false

mxschmitt

mxschmitt commented on May 6, 2025

@mxschmitt
Member

@johnnyqian are you interested to run codegen in "a persistent user context" or "your default user context aka. your Chrome/Edge profile"?

johnnyqian

johnnyqian commented on May 6, 2025

@johnnyqian
Author

I prefer the default user context which has my signed-in Chrome/Edge profile. Is this possible?

mxschmitt

mxschmitt commented on May 6, 2025

@mxschmitt
Member

Chrome unfortunately does not allow this anymore starting from Chrome 136: https://developer.chrome.com/blog/remote-debugging-port

There is still an escape hatch via:

const { chromium } = require('@playwright/test');

(async () => {
  // put there the profile path from chrome://version (without the /Default at the end).
  const context = await chromium.launchPersistentContext('your-profile', { headless: false, args: ['--disable-features=DevToolsDebuggingRestrictions'] });
  const page = context.pages()[0];
  await page.pause();
  await context.close()
})();

could you try if that works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @agg23@pavelfeldman@johnnyqian@mxschmitt

    Issue actions

      [Feature]: Please allow playwright codegen to launch the browser in normal mode instead of InPrivate/Incognito mode · Issue #35617 · microsoft/playwright