From f76f793dd6e80e132e877db4b0c215162b495297 Mon Sep 17 00:00:00 2001 From: "microsoft-playwright-automation[bot]" <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 21:53:39 +0000 Subject: [PATCH] chore: roll Playwright to 1.66.0-alpha-2026-11-16 Fixes: https://github.com/microsoft/playwright-cli/issues/540 --- README.md | 12 +++++++ package-lock.json | 28 +++++++-------- package.json | 6 ++-- skills/playwright-cli/SKILL.md | 12 ++++--- .../references/session-management.md | 35 +++++++++++++++++-- tests/integration.spec.ts | 18 ++++++++-- 6 files changed, 85 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 04b674f0..e41a214f 100644 --- a/README.md +++ b/README.md @@ -334,6 +334,18 @@ playwright-cli close # close the browser playwright-cli delete-data # delete user data for default session ``` +Extension sessions control only their own tabs and place them in a tab group. Use a session name +and color to tell groups apart: + +```bash +playwright-cli attach --extension=chrome --session=finance --session-color=blue +playwright-cli -s=finance goto https://example.com +playwright-cli -s=finance detach --close-tabs +``` + +By default, `detach` leaves the tabs open. For extension sessions, `--close-tabs` closes all tabs +of the session, including tabs the user selected when connecting, but leaves other tabs open. + ### Snapshots After each command, playwright-cli provides a snapshot of the current browser state. diff --git a/package-lock.json b/package-lock.json index e942da17..214e9109 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,14 +9,14 @@ "version": "0.1.24", "license": "Apache-2.0", "dependencies": { - "playwright": "1.66.0-alpha-1794252756000", - "playwright-core": "1.66.0-alpha-1794252756000" + "playwright": "1.66.0-alpha-2026-11-16", + "playwright-core": "1.66.0-alpha-2026-11-16" }, "bin": { "playwright-cli": "playwright-cli.js" }, "devDependencies": { - "@playwright/test": "1.66.0-alpha-1794252756000", + "@playwright/test": "1.66.0-alpha-2026-11-16", "@types/node": "^25.2.1" }, "engines": { @@ -24,13 +24,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.66.0-alpha-1794252756000", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.66.0-alpha-1794252756000.tgz", - "integrity": "sha512-9ufwZ2mFxj0Ro5kYbs2oDfI8LUqwVZGCXL35cqL+ks1fZZ/UfnJlZQQeI9YjbxMqpDjWhoyYYhcY9yf9BSZYjg==", + "version": "1.66.0-alpha-2026-11-16", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.66.0-alpha-2026-11-16.tgz", + "integrity": "sha512-ddrbwhiJmq4lwiI73A+74AmsytBYb/YqaSgej5CbtHfLVoCUsS+suW/oD+dvUEzfihhZFxTXNYE9gZh/w1Vjmw==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.66.0-alpha-1794252756000" + "playwright": "1.66.0-alpha-2026-11-16" }, "bin": { "playwright": "cli.js" @@ -50,12 +50,12 @@ } }, "node_modules/playwright": { - "version": "1.66.0-alpha-1794252756000", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.66.0-alpha-1794252756000.tgz", - "integrity": "sha512-/9xFhtBUua3Qu3ZIwg1ZoR+bNj+laHp6GxZXvc4gUN5TngCaKbIUPGTTIofnss0mRAkGfY7zUiF/xu/H2CqTFQ==", + "version": "1.66.0-alpha-2026-11-16", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.66.0-alpha-2026-11-16.tgz", + "integrity": "sha512-dR54ODvzCRXHRh7blOBFHqrNeMyOr3aPY9kp13kmADpmjLOzH8tQR5HGH/0dCA3dHBzh5SvJyB4XrAxKgmWLxA==", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.66.0-alpha-1794252756000" + "playwright-core": "1.66.0-alpha-2026-11-16" }, "bin": { "playwright": "cli.js" @@ -65,9 +65,9 @@ } }, "node_modules/playwright-core": { - "version": "1.66.0-alpha-1794252756000", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.66.0-alpha-1794252756000.tgz", - "integrity": "sha512-AiVQEDLnkpZfEhfXOpqzZA06guT1drbfdcDbV5gePzcr/GdB/9RXnc8FrvV2YNgju0w4JERJllO24n5PmZDQ+A==", + "version": "1.66.0-alpha-2026-11-16", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.66.0-alpha-2026-11-16.tgz", + "integrity": "sha512-l3N8eBs67Wre9Wjv8vCzH3YWRrVGBXNNmg/YZg7hFOo+3fIezy9UGHzQcnInht9k/YSPfYrPQoPj9WvZcBiXqw==", "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" diff --git a/package.json b/package.json index 2e4ef98b..391bf98f 100644 --- a/package.json +++ b/package.json @@ -18,12 +18,12 @@ "test": "playwright test" }, "devDependencies": { - "@playwright/test": "1.66.0-alpha-1794252756000", + "@playwright/test": "1.66.0-alpha-2026-11-16", "@types/node": "^25.2.1" }, "dependencies": { - "playwright": "1.66.0-alpha-1794252756000", - "playwright-core": "1.66.0-alpha-1794252756000" + "playwright": "1.66.0-alpha-2026-11-16", + "playwright-core": "1.66.0-alpha-2026-11-16" }, "bin": { "playwright-cli": "playwright-cli.js" diff --git a/skills/playwright-cli/SKILL.md b/skills/playwright-cli/SKILL.md index aa8dea4b..4ad911bd 100644 --- a/skills/playwright-cli/SKILL.md +++ b/skills/playwright-cli/SKILL.md @@ -285,8 +285,12 @@ playwright-cli open --persistent # Use persistent profile with custom directory playwright-cli open --profile=/path/to/profile -# Connect to browser via Playwright Extension -playwright-cli attach --extension=chrome +# Connect to the browser profile of the user via Playwright Extension (chrome, msedge, ...). +# The session name is the title of the tab group; pick a color to tell sessions apart. +playwright-cli attach --extension=chrome --session=finance --session-color=blue +playwright-cli -s=finance goto https://example.com +# Detach and close the tabs of the session, when the user does not need them +playwright-cli -s=finance detach --close-tabs # Connect to a running Chrome or Edge by channel name playwright-cli attach --cdp=chrome @@ -403,7 +407,7 @@ playwright-cli kill-all Package installation and custom `npm` scripts may require separate approval. -If global `playwright-cli` command is not available, try a local version via `npx playwright cli`: +If global `playwright-cli` command is not available, try a local version via `npx playwright cli`. It needs Playwright 1.59 or newer: ```bash npx --no-install playwright --version @@ -484,7 +488,7 @@ See [references/pr-attachments.md](references/pr-attachments.md) for alt text, i * **Running and Debugging Playwright tests** [references/playwright-tests.md](references/playwright-tests.md) * **Request mocking** [references/request-mocking.md](references/request-mocking.md) * **Running Playwright code** [references/running-code.md](references/running-code.md) -* **Browser session management** [references/session-management.md](references/session-management.md) +* **Browser session management, attaching to the browser of the user** [references/session-management.md](references/session-management.md) * **Storage state (cookies, localStorage)** [references/storage-state.md](references/storage-state.md) * **Test generation (plan / generate / heal)** [references/test-generation.md](references/test-generation.md) * **Tracing** [references/tracing.md](references/tracing.md) diff --git a/skills/playwright-cli/references/session-management.md b/skills/playwright-cli/references/session-management.md index eb1bde35..96f126b5 100644 --- a/skills/playwright-cli/references/session-management.md +++ b/skills/playwright-cli/references/session-management.md @@ -143,12 +143,41 @@ playwright-cli attach --cdp=http://localhost:9222 ### Attach via browser extension -Connect to a browser with the Playwright extension installed: +Connect to the everyday browser profile of the user: their tabs, logins and cookies. The browser must have the Playwright Extension installed. Name the browser, because the extension can be in Edge and not in Chrome: ```bash -playwright-cli attach --extension +playwright-cli attach --extension=chrome +playwright-cli attach --extension=msedge ``` +When the extension is not installed in that browser, `attach` fails with `Playwright Extension not found in ""`. Try the other browser, or ask the user to install the extension. + +The session controls only its own tabs: the tabs that the user picked on the connect page, and the tabs that the session opened. The extension puts them into a tab group. Give the session a name for the task, and optionally a color: + +```bash +# The tab group has the title "finance" and the color blue. +# Colors: blue, red, yellow, green, pink, purple, cyan, orange. +playwright-cli attach --extension=msedge --session=finance --session-color=blue + +# Each next command names the session +playwright-cli -s=finance goto https://example.com +playwright-cli -s=finance snapshot +``` + +Without `--session`, the session has the name of the browser (`chrome`, `msedge`). Without `--session-color`, the group takes the first color that no other session uses. Pass `--no-tab-group` to leave the tabs where the user has them. + +When the work is done, detach. The browser of the user keeps running: + +```bash +# Leave the tabs open. The tab group stays and turns gray, and the user can continue in it. +playwright-cli -s=finance detach + +# Close the tabs of the session. Use it to clean up tabs that the user does not need any more. +playwright-cli -s=finance detach --close-tabs +``` + +`--close-tabs` closes all tabs of the session, also the tabs that the user picked for it. It never closes other tabs of the user. + ### Detach Tear down an attached session without affecting the external browser: @@ -161,7 +190,7 @@ playwright-cli detach playwright-cli -s=msedge detach ``` -`detach` only works on sessions created via `attach`. For sessions created via `open`, use `close`. +`detach` only works on sessions created via `attach`. For sessions created via `open`, use `close`. `detach --close-tabs` only works on sessions created via `attach --extension`. ## Default Browser Session diff --git a/tests/integration.spec.ts b/tests/integration.spec.ts index 47c1afa2..214ae26e 100644 --- a/tests/integration.spec.ts +++ b/tests/integration.spec.ts @@ -107,7 +107,12 @@ async function runCli(args: string[], env: Record = {}): Promise }); } -test('open data URL', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright-cli/issues/502' } }, async ({}) => { +test('open data URL', { + annotation: [ + { type: 'issue', description: 'https://github.com/microsoft/playwright-cli/issues/502' }, + { type: 'issue', description: 'https://github.com/microsoft/playwright-cli/issues/540' }, + ], +}, async ({}) => { const argumentError = "boolean option '--headed' should not be passed with '=value', use '--headed' or '--no-headed' instead"; expect(await runCli(['open', '--headed=false'])).toEqual({ output: '', @@ -121,11 +126,20 @@ test('open data URL', { annotation: { type: 'issue', description: 'https://githu exitCode: 1, }); - expect(await runCli(['open', 'data:text/html,hello', '--persistent'])).toEqual(expect.objectContaining({ + const browsersPath = test.info().outputPath('empty-browsers'); + expect(await runCli(['open', 'data:text/html,hello', '--persistent'], { + PLAYWRIGHT_BROWSERS_PATH: browsersPath, + })).toEqual(expect.objectContaining({ output: expect.stringContaining('hello'), exitCode: 0, })); + const missingFfmpeg = await runCli(['video-start', 'video.webm']); + expect(missingFfmpeg.output).toContain('FFmpeg is not installed'); + expect(missingFfmpeg.output).toContain(`expected executable at ${browsersPath}`); + expect(missingFfmpeg.output).toContain('playwright-cli install-browser ffmpeg'); + expect(missingFfmpeg.output).not.toContain('npx playwright install ffmpeg'); + expect(await runCli(['--json', 'screenshot', '--filename'])).toEqual({ output: JSON.stringify({ isError: true, error: "error: '--filename' option: expected string, received boolean" }, null, 2), error: '',