chore: allow right click (#687)

Fixes https://github.com/microsoft/playwright-mcp/issues/467
This commit is contained in:
Pavel Feldman 2025-07-17 13:24:05 -07:00 committed by GitHub
parent fe0c0ffffe
commit c97bc6e2ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 156 additions and 82 deletions

View file

@ -19,12 +19,11 @@ import net from 'node:net';
import path from 'node:path';
import os from 'node:os';
import debug from 'debug';
import * as playwright from 'playwright';
import type { FullConfig } from './config.js';
import { logUnhandledError, testDebug } from './log.js';
const testDebug = debug('pw:mcp:test');
import type { FullConfig } from './config.js';
export function contextFactory(browserConfig: FullConfig['browser']): BrowserContextFactory {
if (browserConfig.remoteEndpoint)
@ -84,10 +83,10 @@ class BaseContextFactory implements BrowserContextFactory {
testDebug(`close browser context (${this.name})`);
if (browser.contexts().length === 1)
this._browserPromise = undefined;
await browserContext.close().catch(() => {});
await browserContext.close().catch(logUnhandledError);
if (browser.contexts().length === 0) {
testDebug(`close browser (${this.name})`);
await browser.close().catch(() => {});
await browser.close().catch(logUnhandledError);
}
}
}