Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test(mcp): activate page before reading the clipboard (#42443)

Dmitry Gozman80ef9143825c
diff --git a/tests/mcp/clipboard.spec.ts b/tests/mcp/clipboard.spec.ts
index 051939050a..bc17f026ed 100644
--- a/tests/mcp/clipboard.spec.ts
+++ b/tests/mcp/clipboard.spec.ts
@@ -37,6 +37,12 @@ test('clipboard write without permission dialog', async ({ startClient, server,
expect(writeResult).toHaveResponse({
result: '"Write successful"',
});
+ // Chromium 153+ only allows reading the clipboard once the page has been
+ // activated by a real input event, so interact with it first.
+ await client.callTool({
+ name: 'browser_press_key',
+ arguments: { key: 'a' },
+ });
const readResult = await client.callTool({
name: 'browser_evaluate',
arguments: {