diff --git a/dotnet/docs/codegen.mdx b/dotnet/docs/codegen.mdx index f106141b0ad..90f4855ac72 100644 --- a/dotnet/docs/codegen.mdx +++ b/dotnet/docs/codegen.mdx @@ -134,6 +134,19 @@ pwsh bin/Debug/netX/playwright.ps1 codegen --load-storage=auth.json github.com/m ###### github signed in showing use of load storage scharp +#### Use existing userDataDir + +Run `codegen` with `--user-data-dir` to set a fixed [user data directory](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context-option-user-data-dir) for the browser session. If you create a custom browser user data directory, codegen will use this existing browser profile and have access to any authentication state present in that profile. + +:::warning + +[As of Chrome 136, the default user data directory cannot be accessed via automated tooling](https://developer.chrome.com/blog/remote-debugging-port), such as Playwright. You must create a separate user data directory for use in testing. +::: + +```bash +pwsh bin/Debug/netX/playwright.ps1 codegen --user-data-dir=/path/to/your/browser/data/ github.com/microsoft/playwright +``` + ## Record using custom setup If you would like to use codegen in some non-standard setup (for example, use [BrowserContext.RouteAsync()](/api/class-browsercontext.mdx#browser-context-route)), it is possible to call [Page.PauseAsync()](/api/class-page.mdx#page-pause) that will open a separate window with codegen controls. diff --git a/java/docs/codegen.mdx b/java/docs/codegen.mdx index dc44d203f23..1d5ec814d2c 100644 --- a/java/docs/codegen.mdx +++ b/java/docs/codegen.mdx @@ -134,6 +134,19 @@ mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="co ###### github signed in showing use of load storage java +#### Use existing userDataDir + +Run `codegen` with `--user-data-dir` to set a fixed [user data directory](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context-option-user-data-dir) for the browser session. If you create a custom browser user data directory, codegen will use this existing browser profile and have access to any authentication state present in that profile. + +:::warning + +[As of Chrome 136, the default user data directory cannot be accessed via automated tooling](https://developer.chrome.com/blog/remote-debugging-port), such as Playwright. You must create a separate user data directory for use in testing. +::: + +```bash +mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --user-data-dir=/path/to/your/browser/data/ github.com/microsoft/playwright" +``` + ## Record using custom setup If you would like to use codegen in some non-standard setup (for example, use [BrowserContext.route()](/api/class-browsercontext.mdx#browser-context-route)), it is possible to call [Page.pause()](/api/class-page.mdx#page-pause) that will open a separate window with codegen controls. diff --git a/nodejs/docs/codegen.mdx b/nodejs/docs/codegen.mdx index a219dd44e1b..f38a1d9f376 100644 --- a/nodejs/docs/codegen.mdx +++ b/nodejs/docs/codegen.mdx @@ -184,6 +184,19 @@ npx playwright codegen --load-storage=auth.json github.com/microsoft/playwright ###### github signed in showing use of load storage js +#### Use existing userDataDir + +Run `codegen` with `--user-data-dir` to set a fixed [user data directory](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context-option-user-data-dir) for the browser session. If you create a custom browser user data directory, codegen will use this existing browser profile and have access to any authentication state present in that profile. + +:::warning + +[As of Chrome 136, the default user data directory cannot be accessed via automated tooling](https://developer.chrome.com/blog/remote-debugging-port), such as Playwright. You must create a separate user data directory for use in testing. +::: + +```bash +npx playwright codegen --user-data-dir=/path/to/your/browser/data/ github.com/microsoft/playwright +``` + ## Record using custom setup If you would like to use codegen in some non-standard setup (for example, use [browserContext.route()](/api/class-browsercontext.mdx#browser-context-route)), it is possible to call [page.pause()](/api/class-page.mdx#page-pause) that will open a separate window with codegen controls. diff --git a/python/docs/codegen.mdx b/python/docs/codegen.mdx index 29461b9770d..991da16486e 100644 --- a/python/docs/codegen.mdx +++ b/python/docs/codegen.mdx @@ -134,6 +134,19 @@ playwright codegen --load-storage=auth.json github.com/microsoft/playwright ###### github signed in showing use of load storage python +#### Use existing userDataDir + +Run `codegen` with `--user-data-dir` to set a fixed [user data directory](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context-option-user-data-dir) for the browser session. If you create a custom browser user data directory, codegen will use this existing browser profile and have access to any authentication state present in that profile. + +:::warning + +[As of Chrome 136, the default user data directory cannot be accessed via automated tooling](https://developer.chrome.com/blog/remote-debugging-port), such as Playwright. You must create a separate user data directory for use in testing. +::: + +```bash +playwright codegen --user-data-dir=/path/to/your/browser/data/ github.com/microsoft/playwright +``` + ## Record using custom setup If you would like to use codegen in some non-standard setup (for example, use [browser_context.route()](/api/class-browsercontext.mdx#browser-context-route)), it is possible to call [page.pause()](/api/class-page.mdx#page-pause) that will open a separate window with codegen controls.