From fd90ce3a2f0496e5a853e6f893065cb46745af07 Mon Sep 17 00:00:00 2001
From: "microsoft-playwright-automation[bot]"
<203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
Date: Fri, 4 Jul 2025 10:09:26 +0000
Subject: [PATCH] feat(roll): roll to ToT Playwright (04-07-25)
---
dotnet/docs/codegen.mdx | 13 +++++++++++++
java/docs/codegen.mdx | 13 +++++++++++++
nodejs/docs/codegen.mdx | 13 +++++++++++++
python/docs/codegen.mdx | 13 +++++++++++++
4 files changed, 52 insertions(+)
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
######
+#### 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
######
+#### 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
######
+#### 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
######
+#### 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.