Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: implement session stop (#38912)
Pavel Feldman7b68bf65c1d8
diff --git a/packages/playwright/src/mcp/terminal/DEPS.list b/packages/playwright/src/mcp/terminal/DEPS.listindex bdc43d74d9..18c7c0e142 100644--- a/packages/playwright/src/mcp/terminal/DEPS.list+++ b/packages/playwright/src/mcp/terminal/DEPS.list@@ -1,2 +1,6 @@[daemon.ts]../browser/tools+../cli/socketConnection.ts++[cli.ts]+./socketConnection.tsdiff --git a/packages/playwright/src/mcp/terminal/cli.ts b/packages/playwright/src/mcp/terminal/cli.tsindex 0e908f683d..0c7116e979 100644--- a/packages/playwright/src/mcp/terminal/cli.ts+++ b/packages/playwright/src/mcp/terminal/cli.ts@@ -26,46 +26,29 @@ import path from 'path';import { debug } from 'playwright-core/lib/utilsBundle';import { SocketConnection } from './socketConnection';-import type * as mcp from '../sdk/exports';-const debugCli = debug('pw:cli');-const packageJSON = require('../../../package.json');-async function runCliCommand(sessionName: string, args: any) {- const session = await connectToDaemon(sessionName);- const result = await session.runCliCommand(args);- console.log(result);- session.dispose();-}--async function socketExists(socketPath: string): Promise<boolean> {- try {- const stat = await fs.promises.stat(socketPath);- if (stat?.isSocket())- return true;- } catch (e) {- }- return false;-}--class SocketSession {+class Session {+ readonly name: string;private _connection: SocketConnection;private _nextMessageId = 1;private _callbacks = new Map<number, { resolve: (o: any) => void, reject: (e: Error) => void }>();- constructor(connection: SocketConnection) {+ constructor(name: string, connection: SocketConnection) {+ this.name = name;this._connection = connection;this._connection.onmessage = message => this._onMessage(message);- this._connection.onclose = () => this.dispose();+ this._connection.onclose = () => this.close();}- async callTool(name: string, args: mcp.CallToolRequest['params']['arguments']): Promise<mcp.CallToolResult> {- return this._send(name, args);+ async run(args: any): Promise<string> {+ return await this._send('run', { args });}- async runCliCommand(args: any): Promise<string> {- return await this._send('runCliCommand', { args });+ async stop(): Promise<void> {+ await this._send('stop');+ this.close();}private async _send(method: string, params: any = {}): Promise<any> {@@ -81,9 +64,9 @@ class SocketSession {});}- dispose() {+ close() {for (const callback of this._callbacks.values())- callback.reject(new Error('Disposed'));+ callback.reject(new Error('Session closed'));this._callbacks.clear();this._connection.close();}@@ -104,183 +87,191 @@ class SocketSession {}}-function localCacheDir(): string {- if (process.platform === 'linux')- return process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache');- if (process.platform === 'darwin')- return path.join(os.homedir(), 'Library', 'Caches');- if (process.platform === 'win32')- return process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');- throw new Error('Unsupported platform: ' + process.platform);-}+class SessionManager {-function playwrightCacheDir(): string {- return path.join(localCacheDir(), 'ms-playwright');-}+ async list(): Promise<{ name: string, live: boolean }[]> {+ const dir = daemonSocketDir;+ try {+ const files = await fs.promises.readdir(dir);+ const sessions: { name: string, live: boolean }[] = [];+ for (const file of files) {+ if (file.endsWith('-user-data')) {+ const sessionName = file.slice(0, -'-user-data'.length);+ const live = await this._canConnect(sessionName);+ sessions.push({ name: sessionName, live });+ }+ }+ return sessions;+ } catch {+ return [];+ }+ }-function calculateSha1(buffer: Buffer | string): string {- const hash = crypto.createHash('sha1');- hash.update(buffer);- return hash.digest('hex');-}+ async run(args: any): Promise<void> {+ const sessionName = this._resolveSessionName(args.session);+ const session = await this._connect(sessionName);+ const result = await session.run(args);+ console.log(result);+ session.close();+ }-function socketDirHash(): string {- return calculateSha1(__dirname);-}+ async stop(sessionName?: string): Promise<void> {+ sessionName = this._resolveSessionName(sessionName);-function daemonSocketDir(): string {- return path.resolve(playwrightCacheDir(), 'daemon', socketDirHash());-}+ if (!await this._canConnect(sessionName)) {+ console.log(`Session '${sessionName}' is not running.`);+ return;+ }-function daemonSocketPath(sessionName: string): string {- const socketName = `${sessionName}.sock`;- if (os.platform() === 'win32')- return `\\\\.\\pipe\\${socketDirHash()}-${socketName}`;- return path.resolve(daemonSocketDir(), socketName);-}+ const session = await this._connect(sessionName);+ await session.stop();+ console.log(`Session '${sessionName}' stopped.`);+ }-async function connectToDaemon(sessionName: string): Promise<SocketSession> {- const socketPath = daemonSocketPath(sessionName);- debugCli(`Connecting to daemon at ${socketPath}`);+ async delete(sessionName?: string): Promise<void> {+ sessionName = this._resolveSessionName(sessionName);- if (await socketExists(socketPath)) {- debugCli(`Socket file exists, attempting to connect...`);- try {- return await connectToSocket(socketPath);- } catch (e) {- // Connection failed, delete the stale socket file.- if (os.platform() !== 'win32')- await fs.promises.unlink(socketPath).catch(() => {});+ // Stop the session if it's running+ if (await this._canConnect(sessionName)) {+ const session = await this._connect(sessionName);+ await session.stop();}- }- const cliPath = path.join(__dirname, '../../../cli.js');- debugCli(`Will launch daemon process: ${cliPath}`);-- const userDataDir = path.resolve(daemonSocketDir(), `${sessionName}-user-data`);- const child = spawn(process.execPath, [cliPath, 'run-mcp-server', `--daemon=${socketPath}`, `--user-data-dir=${userDataDir}`], {- detached: true,- stdio: 'ignore',- cwd: process.cwd(), // Will be used as root.- });- child.unref();-- // Wait for the socket to become available with retries.- const maxRetries = 50;- const retryDelay = 100; // ms- for (let i = 0; i < maxRetries; i++) {- await new Promise(resolve => setTimeout(resolve, 100));+ // Delete user data directory+ const userDataDir = path.resolve(daemonSocketDir, `${sessionName}-user-data`);try {- return await connectToSocket(socketPath);- } catch (e) {- if (e.code !== 'ENOENT')+ await fs.promises.rm(userDataDir, { recursive: true });+ console.log(`Deleted user data for session '${sessionName}'.`);+ } catch (e: any) {+ if (e.code === 'ENOENT')+ console.log(`No user data found for session '${sessionName}'.`);+ elsethrow e;- debugCli(`Retrying to connect to daemon at ${socketPath} (${i + 1}/${maxRetries})`);++ }++ // Also try to delete the socket file if it exists+ if (os.platform() !== 'win32') {+ const socketPath = this._daemonSocketPath(sessionName);+ await fs.promises.unlink(socketPath).catch(() => {});}}- throw new Error(`Failed to connect to daemon at ${socketPath} after ${maxRetries * retryDelay}ms`);-}-async function connectToSocket(socketPath: string): Promise<SocketSession> {- const socket = await new Promise<net.Socket>((resolve, reject) => {- const socket = net.createConnection(socketPath, () => {- debugCli(`Connected to daemon at ${socketPath}`);- resolve(socket);- });- socket.on('error', reject);- });- return new SocketSession(new SocketConnection(socket));-}+ private async _connect(sessionName: string): Promise<Session> {+ const socketPath = this._daemonSocketPath(sessionName);+ debugCli(`Connecting to daemon at ${socketPath}`);++ const socketExists = await fs.promises.stat(socketPath)+ .then(stat => stat?.isSocket() ?? false)+ .catch(() => false);++ if (socketExists) {+ debugCli(`Socket file exists, attempting to connect...`);+ try {+ return await this._connectToSocket(sessionName, socketPath);+ } catch (e) {+ // Connection failed, delete the stale socket file.+ if (os.platform() !== 'win32')+ await fs.promises.unlink(socketPath).catch(() => {});+ }+ }-function currentSessionPath(): string {- return path.resolve(daemonSocketDir(), 'current-session');-}+ const cliPath = path.join(__dirname, '../../../cli.js');+ debugCli(`Will launch daemon process: ${cliPath}`);-async function getCurrentSession(): Promise<string> {- try {- const session = await fs.promises.readFile(currentSessionPath(), 'utf-8');- return session.trim() || 'default';- } catch {- return 'default';+ const userDataDir = path.resolve(daemonSocketDir, `${sessionName}-user-data`);+ const child = spawn(process.execPath, [cliPath, 'run-mcp-server', `--daemon=${socketPath}`, `--user-data-dir=${userDataDir}`], {+ detached: true,+ stdio: 'ignore',+ cwd: process.cwd(), // Will be used as root.+ });+ child.unref();++ // Wait for the socket to become available with retries.+ const maxRetries = 50;+ const retryDelay = 100; // ms+ for (let i = 0; i < maxRetries; i++) {+ await new Promise(resolve => setTimeout(resolve, 100));+ try {+ return await this._connectToSocket(sessionName, socketPath);+ } catch (e) {+ if (e.code !== 'ENOENT')+ throw e;+ debugCli(`Retrying to connect to daemon at ${socketPath} (${i + 1}/${maxRetries})`);+ }+ }+ throw new Error(`Failed to connect to daemon at ${socketPath} after ${maxRetries * retryDelay}ms`);}-}--async function setCurrentSession(sessionName: string): Promise<void> {- await fs.promises.mkdir(daemonSocketDir(), { recursive: true });- await fs.promises.writeFile(currentSessionPath(), sessionName);-}-async function canConnectToSocket(socketPath: string): Promise<boolean> {- return new Promise<boolean>(resolve => {- const socket = net.createConnection(socketPath, () => {- socket.destroy();- resolve(true);+ private async _connectToSocket(sessionName: string, socketPath: string): Promise<Session> {+ const socket = await new Promise<net.Socket>((resolve, reject) => {+ const socket = net.createConnection(socketPath, () => {+ debugCli(`Connected to daemon at ${socketPath}`);+ resolve(socket);+ });+ socket.on('error', reject);});- socket.on('error', () => {- resolve(false);+ return new Session(sessionName, new SocketConnection(socket));+ }++ private async _canConnect(sessionName: string): Promise<boolean> {+ const socketPath = this._daemonSocketPath(sessionName);+ return new Promise<boolean>(resolve => {+ const socket = net.createConnection(socketPath, () => {+ socket.destroy();+ resolve(true);+ });+ socket.on('error', () => {+ resolve(false);+ });});- });-}+ }-async function listSessions(): Promise<{ name: string, live: boolean }[]> {- const dir = daemonSocketDir();- try {- const files = await fs.promises.readdir(dir);- const sessions: { name: string, live: boolean }[] = [];- for (const file of files) {- if (file.endsWith('-user-data')) {- const sessionName = file.slice(0, -'-user-data'.length);- const socketPath = daemonSocketPath(sessionName);- const live = await canConnectToSocket(socketPath);- sessions.push({ name: sessionName, live });- }- }- return sessions;- } catch {- return [];+ private _resolveSessionName(sessionName?: string): string {+ if (sessionName)+ return sessionName;+ if (process.env.PLAYWRIGHT_CLI_SESSION)+ return process.env.PLAYWRIGHT_CLI_SESSION;+ return 'default';}-}-function resolveSessionName(args: any): string {- if (args.session)- return args.session;- if (process.env.PLAYWRIGHT_CLI_SESSION)- return process.env.PLAYWRIGHT_CLI_SESSION;- return 'default';+ private _daemonSocketPath(sessionName: string): string {+ const socketName = `${sessionName}.sock`;+ if (os.platform() === 'win32')+ return `\\\\.\\pipe\\${socketDirHash}-${socketName}`;+ return path.join(daemonSocketDir, socketName);+ }}-async function handleSessionCommand(args: any): Promise<void> {- const subcommand = args._[1];-- if (!subcommand) {- // Show current session- const current = await getCurrentSession();- console.log(current);- return;- }+async function handleSessionCommand(sessionManager: SessionManager, args: any): Promise<void> {+ const subcommand = args._[0].split('-').slice(1).join('-');if (subcommand === 'list') {- const sessions = await listSessions();- const current = await getCurrentSession();+ const sessions = await sessionManager.list();console.log('Sessions:');for (const session of sessions) {- const marker = session.name === current ? '->' : ' ';const liveMarker = session.live ? ' (live)' : '';- console.log(`${marker} ${session.name}${liveMarker}`);+ console.log(` ${session.name}${liveMarker}`);}if (sessions.length === 0)- console.log(' (no sessions)');+ console.log(' (no sessions)');return;}- if (subcommand === 'set') {- const sessionName = args._[2];- if (!sessionName) {- console.error('Usage: playwright-cli session set <session-name>');- process.exit(1);- }- await setCurrentSession(sessionName);- console.log(`Current session set to: ${sessionName}`);+ if (subcommand === 'stop') {+ await sessionManager.stop(args._[1]);+ return;+ }++ if (subcommand === 'stop-all') {+ const sessions = await sessionManager.list();+ for (const session of sessions)+ await sessionManager.stop(session.name);+ return;+ }++ if (subcommand === 'delete') {+ await sessionManager.delete(args._[1]);return;}@@ -288,6 +279,25 @@ async function handleSessionCommand(args: any): Promise<void> {process.exit(1);}+const socketDirHash = (() => {+ const hash = crypto.createHash('sha1');+ hash.update(require.resolve('../../../package.json'));+ return hash.digest('hex');+})();++const daemonSocketDir = (() => {+ let localCacheDir: string | undefined;+ if (process.platform === 'linux')+ localCacheDir = process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache');+ if (process.platform === 'darwin')+ localCacheDir = path.join(os.homedir(), 'Library', 'Caches');+ if (process.platform === 'win32')+ localCacheDir = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');+ if (!localCacheDir)+ throw new Error('Unsupported platform: ' + process.platform);+ return path.join(localCacheDir, 'ms-playwright', 'daemon', 'daemon', socketDirHash);+})();+async function main() {const argv = process.argv.slice(2);const args = require('minimist')(argv);@@ -299,12 +309,6 @@ async function main() {process.exit(0);}- // Handle 'session' command specially - it doesn't need daemon connection- if (commandName === 'session') {- await handleSessionCommand(args);- return;- }-const command = help.commands[commandName];if (args.help || args.h) {if (command) {@@ -321,15 +325,13 @@ async function main() {process.exit(1);}- // Resolve session name: --session flag > PLAYWRIGHT_CLI_SESSION env > current session > 'default'- let sessionName = resolveSessionName(args);- if (sessionName === 'default' && !args.session && !process.env.PLAYWRIGHT_CLI_SESSION)- sessionName = await getCurrentSession();+ const sessionManager = new SessionManager();+ if (commandName.startsWith('session')) {+ await handleSessionCommand(sessionManager, args);+ return;+ }- runCliCommand(sessionName, args).catch(e => {- console.error(e.message);- process.exit(1);- });+ await sessionManager.run(args);}main().catch(e => {diff --git a/packages/playwright/src/mcp/terminal/command.ts b/packages/playwright/src/mcp/terminal/command.tsindex 32e6fdd05f..152414669d 100644--- a/packages/playwright/src/mcp/terminal/command.ts+++ b/packages/playwright/src/mcp/terminal/command.ts@@ -17,7 +17,7 @@import type zodType from 'zod';-export type Category = 'core' | 'navigation' | 'keyboard' | 'mouse' | 'export' | 'storage' | 'tabs' | 'devtools';+export type Category = 'core' | 'navigation' | 'keyboard' | 'mouse' | 'export' | 'storage' | 'tabs' | 'devtools' | 'session';export type CommandSchema<Args extends zodType.ZodTypeAny, Options extends zodType.ZodTypeAny> = {name: string;diff --git a/packages/playwright/src/mcp/terminal/commands.ts b/packages/playwright/src/mcp/terminal/commands.tsindex 861644c4ff..99025fb16f 100644--- a/packages/playwright/src/mcp/terminal/commands.ts+++ b/packages/playwright/src/mcp/terminal/commands.ts@@ -474,6 +474,47 @@ const tracingStop = declareCommand({toolParams: () => ({}),});+// Sessions++const sessionList = declareCommand({+ name: 'session-list',+ description: 'List all sessions',+ category: 'session',+ args: z.object({}),+ toolName: '',+ toolParams: () => ({}),+});++const sessionStop = declareCommand({+ name: 'session-stop',+ description: 'Stop session',+ category: 'session',+ args: z.object({+ name: z.string().optional().describe('Name of the session to stop. If omitted, current session is stopped.'),+ }),+ toolName: '',+ toolParams: () => ({}),+});++const sessionStopAll = declareCommand({+ name: 'session-stop-all',+ description: 'Stop all sessions',+ category: 'session',+ toolName: '',+ toolParams: () => ({}),+});++const sessionDelete = declareCommand({+ name: 'session-delete',+ description: 'Delete session data',+ category: 'session',+ args: z.object({+ name: z.string().optional().describe('Name of the session to delete. If omitted, current session is deleted.'),+ }),+ toolName: '',+ toolParams: ({ name }) => ({ name }),+});+const commandsArray: AnyCommandSchema[] = [// core categoryopen,@@ -526,6 +567,12 @@ const commandsArray: AnyCommandSchema[] = [runCode,tracingStart,tracingStop,++ // session category+ sessionList,+ sessionStop,+ sessionStopAll,+ sessionDelete,];export const commands = Object.fromEntries(commandsArray.map(cmd => [cmd.name, cmd]));diff --git a/packages/playwright/src/mcp/terminal/daemon.ts b/packages/playwright/src/mcp/terminal/daemon.tsindex 8a04d7bf9d..637b42ab18 100644--- a/packages/playwright/src/mcp/terminal/daemon.ts+++ b/packages/playwright/src/mcp/terminal/daemon.ts@@ -21,6 +21,8 @@ import path from 'path';import url from 'url';import { debug } from 'playwright-core/lib/utilsBundle';+import { gracefullyProcessExitDoNotHang } from 'playwright-core/lib/utils';+import { SocketConnection } from './socketConnection';import { commands } from './commands';import { parseCommand } from './command';@@ -82,7 +84,12 @@ export async function startMcpDaemonServer(const { id, method, params } = message;try {daemonDebug('received command', method);- if (method === 'runCliCommand') {+ if (method === 'stop') {+ daemonDebug('stop command received, shutting down');+ await connection.send({ id, result: 'ok' });+ server.close();+ gracefullyProcessExitDoNotHang(0);+ } else if (method === 'run') {const { toolName, toolParams } = parseCliCommand(params.args);const response = await backend.callTool(toolName, toolParams, () => {});await connection.send({ id, result: formatResult(response) });diff --git a/packages/playwright/src/mcp/terminal/help.json b/packages/playwright/src/mcp/terminal/help.jsonindex 441f9bac2a..743df89eb4 100644--- a/packages/playwright/src/mcp/terminal/help.json+++ b/packages/playwright/src/mcp/terminal/help.json@@ -1,5 +1,5 @@{- "global": "Usage: playwright-cli <command> [args] [options]\n\nCore:\n open <url> open url\n close close the page\n type <text> type text into editable element\n click <ref> [button] perform click on a web page\n dblclick <ref> [button] perform double click on a web page\n fill <ref> <text> fill text into editable element\n drag <startRef> <endRef> perform drag and drop between two elements\n hover <ref> hover over element on page\n select <ref> <vals> select an option in a dropdown\n upload <file> upload one or multiple files\n check <ref> check a checkbox or radio button\n uncheck <ref> uncheck a checkbox or radio button\n snapshot capture page snapshot to obtain element ref\n eval <func> [ref] evaluate javascript expression on page or element\n dialog-accept [prompt] accept a dialog\n dialog-dismiss dismiss a dialog\n resize <w> <h> resize the browser window\n\nNavigation:\n go-back go back to the previous page\n go-forward go forward to the next page\n reload reload the current page\n\nKeyboard:\n key-press <key> press a key on the keyboard, `a`, `arrowleft`\n key-down <key> press a key down on the keyboard\n key-up <key> press a key up on the keyboard\n\nMouse:\n mouse-move <x> <y> move mouse to a given position\n mouse-down [button] press mouse down\n mouse-up [button] press mouse up\n mouse-wheel <dx> <dy> scroll mouse wheel\n\nSave as:\n screenshot [ref] screenshot of the current page or element\n pdf save page as pdf\n\nTabs:\n tab-list list all tabs\n tab-new [url] create a new tab\n tab-close [index] close a browser tab\n tab-select <index> select a browser tab\n\nDevTools:\n console [min-level] list console messages\n network list all network requests since loading the page\n run-code <code> run playwright code snippet\n tracing-start start trace recording\n tracing-stop stop trace recording",+ "global": "Usage: playwright-cli <command> [args] [options]\n\nCore:\n open <url> open url\n close close the page\n type <text> type text into editable element\n click <ref> [button] perform click on a web page\n dblclick <ref> [button] perform double click on a web page\n fill <ref> <text> fill text into editable element\n drag <startRef> <endRef> perform drag and drop between two elements\n hover <ref> hover over element on page\n select <ref> <vals> select an option in a dropdown\n upload <file> upload one or multiple files\n check <ref> check a checkbox or radio button\n uncheck <ref> uncheck a checkbox or radio button\n snapshot capture page snapshot to obtain element ref\n eval <func> [ref] evaluate javascript expression on page or element\n dialog-accept [prompt] accept a dialog\n dialog-dismiss dismiss a dialog\n resize <w> <h> resize the browser window\n\nNavigation:\n go-back go back to the previous page\n go-forward go forward to the next page\n reload reload the current page\n\nKeyboard:\n key-press <key> press a key on the keyboard, `a`, `arrowleft`\n key-down <key> press a key down on the keyboard\n key-up <key> press a key up on the keyboard\n\nMouse:\n mouse-move <x> <y> move mouse to a given position\n mouse-down [button] press mouse down\n mouse-up [button] press mouse up\n mouse-wheel <dx> <dy> scroll mouse wheel\n\nSave as:\n screenshot [ref] screenshot of the current page or element\n pdf save page as pdf\n\nTabs:\n tab-list list all tabs\n tab-new [url] create a new tab\n tab-close [index] close a browser tab\n tab-select <index> select a browser tab\n\nDevTools:\n console [min-level] list console messages\n network list all network requests since loading the page\n run-code <code> run playwright code snippet\n tracing-start start trace recording\n tracing-stop stop trace recording\n\nSessions:\n session-list list all sessions\n session-stop [name] stop session\n session-stop-all stop all sessions\n session-delete [name] delete session data","commands": {"open": "playwright-cli open <url>\n\nOpen URL\n\nArguments:\n <url> the url to navigate to\nOptions:\n --headed run browser in headed mode","close": "playwright-cli close \n\nClose the page\n",@@ -38,6 +38,10 @@"network": "playwright-cli network \n\nList all network requests since loading the page\n\nOptions:\n --static whether to include successful static resources like images, fonts, scripts, etc. defaults to false.\n --clear whether to clear the network list","run-code": "playwright-cli run-code <code>\n\nRun Playwright code snippet\n\nArguments:\n <code> a javascript function containing playwright code to execute. it will be invoked with a single argument, page, which you can use for any page interaction.","tracing-start": "playwright-cli tracing-start \n\nStart trace recording\n",- "tracing-stop": "playwright-cli tracing-stop \n\nStop trace recording\n"+ "tracing-stop": "playwright-cli tracing-stop \n\nStop trace recording\n",+ "session-list": "playwright-cli session-list \n\nList all sessions\n",+ "session-stop": "playwright-cli session-stop [name]\n\nStop session\n\nArguments:\n [name] name of the session to stop. if omitted, current session is stopped.",+ "session-stop-all": "playwright-cli session-stop-all \n\nStop all sessions\n",+ "session-delete": "playwright-cli session-delete [name]\n\nDelete session data\n\nArguments:\n [name] name of the session to delete. if omitted, current session is deleted."}}\ No newline at end of filediff --git a/packages/playwright/src/mcp/terminal/helpGenerator.ts b/packages/playwright/src/mcp/terminal/helpGenerator.tsindex f916b27f13..a3b5bd6de3 100644--- a/packages/playwright/src/mcp/terminal/helpGenerator.ts+++ b/packages/playwright/src/mcp/terminal/helpGenerator.ts@@ -74,6 +74,7 @@ const categories: { name: Category, title: string }[] = [{ name: 'tabs', title: 'Tabs' },{ name: 'storage', title: 'Storage' },{ name: 'devtools', title: 'DevTools' },+ { name: 'session', title: 'Sessions' },] as const;function generateHelp() {