playwright 1.56.0-alpha-2025-09-27 → 1.56.0-alpha-2025-09-29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/mcp/browser/tab.js +11 -5
- package/lib/mcp/test/browserBackend.js +11 -1
- package/package.json +2 -2
package/lib/mcp/browser/tab.js
CHANGED
|
@@ -68,13 +68,19 @@ class Tab extends import_events.EventEmitter {
|
|
|
68
68
|
static forPage(page) {
|
|
69
69
|
return page[tabSymbol];
|
|
70
70
|
}
|
|
71
|
-
async
|
|
72
|
-
const
|
|
71
|
+
static async collectConsoleMessages(page) {
|
|
72
|
+
const result = [];
|
|
73
|
+
const messages = await page.consoleMessages().catch(() => []);
|
|
73
74
|
for (const message of messages)
|
|
74
|
-
|
|
75
|
-
const errors = await
|
|
75
|
+
result.push(messageToConsoleMessage(message));
|
|
76
|
+
const errors = await page.pageErrors().catch(() => []);
|
|
76
77
|
for (const error of errors)
|
|
77
|
-
|
|
78
|
+
result.push(pageErrorToConsoleMessage(error));
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
async _initialize() {
|
|
82
|
+
for (const message of await Tab.collectConsoleMessages(this.page))
|
|
83
|
+
this._handleConsoleMessage(message);
|
|
78
84
|
const requests = await this.page.requests().catch(() => []);
|
|
79
85
|
for (const request of requests)
|
|
80
86
|
this._requests.add(request);
|
|
@@ -36,6 +36,7 @@ var import_globals = require("../../common/globals");
|
|
|
36
36
|
var import_util = require("../../util");
|
|
37
37
|
var import_config = require("../browser/config");
|
|
38
38
|
var import_browserServerBackend = require("../browser/browserServerBackend");
|
|
39
|
+
var import_tab = require("../browser/tab");
|
|
39
40
|
async function runBrowserBackendAtEnd(context, errorMessage) {
|
|
40
41
|
const testInfo = (0, import_globals.currentTestInfo)();
|
|
41
42
|
if (!testInfo)
|
|
@@ -55,7 +56,16 @@ async function runBrowserBackendAtEnd(context, errorMessage) {
|
|
|
55
56
|
"",
|
|
56
57
|
`### Page ${stateSuffix}`,
|
|
57
58
|
`- Page URL: ${page.url()}`,
|
|
58
|
-
`- Page Title: ${await page.title()}`.trim()
|
|
59
|
+
`- Page Title: ${await page.title()}`.trim()
|
|
60
|
+
);
|
|
61
|
+
let console = errorMessage ? await import_tab.Tab.collectConsoleMessages(page) : [];
|
|
62
|
+
console = console.filter((msg) => !msg.type || msg.type === "error");
|
|
63
|
+
if (console.length) {
|
|
64
|
+
lines.push("- Console Messages:");
|
|
65
|
+
for (const message of console)
|
|
66
|
+
lines.push(` - ${message.toString()}`);
|
|
67
|
+
}
|
|
68
|
+
lines.push(
|
|
59
69
|
`- Page Snapshot:`,
|
|
60
70
|
"```yaml",
|
|
61
71
|
await page._snapshotForAI(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright",
|
|
3
|
-
"version": "1.56.0-alpha-2025-09-
|
|
3
|
+
"version": "1.56.0-alpha-2025-09-29",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"license": "Apache-2.0",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"playwright-core": "1.56.0-alpha-2025-09-
|
|
67
|
+
"playwright-core": "1.56.0-alpha-2025-09-29"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
70
|
"fsevents": "2.3.2"
|