chore: add support for device (#300)

Fixes https://github.com/microsoft/playwright-mcp/issues/294
This commit is contained in:
Pavel Feldman
2025-04-29 19:51:00 -07:00
committed by GitHub
parent 40d125f0bb
commit 3f72fe53ec
6 changed files with 66 additions and 10 deletions

View File

@@ -306,7 +306,7 @@ ${code.join('\n')}
async function launchPersistentContext(browserConfig: Config['browser']): Promise<playwright.BrowserContext> {
try {
const browserType = browserConfig?.browserName ? playwright[browserConfig.browserName] : playwright.chromium;
return await browserType.launchPersistentContext(browserConfig?.userDataDir || '', browserConfig?.launchOptions);
return await browserType.launchPersistentContext(browserConfig?.userDataDir || '', { ...browserConfig?.launchOptions, ...browserConfig?.contextOptions });
} catch (error: any) {
if (error.message.includes('Executable doesn\'t exist'))
throw new Error(`Browser specified in your config is not installed. Either install it (likely) or change the config.`);