chore: allow reusing tab over cdp (#170)

Fixes https://github.com/microsoft/playwright-mcp/issues/164
This commit is contained in:
Pavel Feldman
2025-04-14 16:39:58 -07:00
committed by GitHub
parent e729494bd9
commit 606b898a71
7 changed files with 63 additions and 21 deletions

View File

@@ -28,7 +28,7 @@ const screenshot: Tool = {
},
handle: async context => {
const tab = context.currentTab();
const tab = await context.ensureTab();
const screenshot = await tab.page.screenshot({ type: 'jpeg', quality: 50, scale: 'css' });
return {
content: [{ type: 'image', data: screenshot.toString('base64'), mimeType: 'image/jpeg' }],