From 660fb4c01406c442c9102f45ab9ed8bf77e62d99 Mon Sep 17 00:00:00 2001 From: "Tommy D. Rossi" Date: Fri, 19 Dec 2025 19:23:06 +0100 Subject: [PATCH] nn --- playwriter/src/mcp.test.ts | 14 ++++---------- playwriter/src/prompt.md | 2 ++ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/playwriter/src/mcp.test.ts b/playwriter/src/mcp.test.ts index e497ed0..5a870c0 100644 --- a/playwriter/src/mcp.test.ts +++ b/playwriter/src/mcp.test.ts @@ -1741,8 +1741,8 @@ describe('MCP Server Tests', () => { { "text": "Return value: { - "error": "Page not found", - "urls": [] + "matchesDark": true, + "matchesLight": false }", "type": "text", }, @@ -1968,20 +1968,14 @@ describe('CDP Session Tests', () => { sampleFunctionNames: functionNames, }).toMatchInlineSnapshot(` { - "durationMicroseconds": 7536, + "durationMicroseconds": 7500, "hasNodes": true, - "nodeCount": 20, + "nodeCount": 7, "sampleFunctionNames": [ "(root)", "(program)", "(idle)", "evaluate", - "fibonacci", - "fibonacci", - "fibonacci", - "fibonacci", - "fibonacci", - "fibonacci", ], } `) diff --git a/playwriter/src/prompt.md b/playwriter/src/prompt.md index 72a51ec..a6b324e 100644 --- a/playwriter/src/prompt.md +++ b/playwriter/src/prompt.md @@ -51,9 +51,11 @@ IMPORTANT! never call bringToFront unless specifically asked by the user. It is - only call `page.close()` if the user asks you so or if you previously created this page yourself with `newPage`. do not close user created pages unless asked - try to never sleep or run `page.waitForTimeout` unless you have to. there are better ways to wait for an element +- use `page.waitForLoadState('load')` instead of `page.waitForEvent('load')`. `waitForEvent` waits for a future event and will timeout if the page is already loaded, while `waitForLoadState` resolves immediately if already in that state - never close browser or context. NEVER call `browser.close()` - NEVER use `page.context().newCDPSession()` or `browser.newCDPSession()` - these do not work through the playwriter relay. If you need to send raw CDP commands, use the `getCDPSession` utility function instead. + ## always check the current page state after an action after you click a button or submit a form you ALWAYS have to then check what is the current state of the page. you cannot assume what happened after doing an action. instead run the following code to know what happened after the action: