playwright 1.57.0-alpha-2025-10-31 → 1.57.0-alpha-1761929702000
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/README.md +2 -2
- package/lib/index.js +1 -1
- package/lib/mcp/browser/response.js +16 -7
- package/lib/mcp/browser/tab.js +6 -3
- package/lib/mcp/test/browserBackend.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🎭 Playwright
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[](https://webkit.org/)<!-- GEN:stop --> [](https://aka.ms/playwright/discord)
|
|
4
4
|
|
|
5
5
|
## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright)
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr
|
|
|
8
8
|
|
|
9
9
|
| | Linux | macOS | Windows |
|
|
10
10
|
| :--- | :---: | :---: | :---: |
|
|
11
|
-
| Chromium <!-- GEN:chromium-version -->
|
|
11
|
+
| Chromium <!-- GEN:chromium-version -->142.0.7444.53<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
|
12
12
|
| WebKit <!-- GEN:webkit-version -->26.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
|
13
13
|
| Firefox <!-- GEN:firefox-version -->142.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
|
14
14
|
|
package/lib/index.js
CHANGED
|
@@ -586,7 +586,7 @@ class ArtifactsRecorder {
|
|
|
586
586
|
return;
|
|
587
587
|
try {
|
|
588
588
|
await page._wrapApiCall(async () => {
|
|
589
|
-
this._pageSnapshot = await page._snapshotForAI({ timeout: 5e3 });
|
|
589
|
+
this._pageSnapshot = (await page._snapshotForAI({ timeout: 5e3 })).full;
|
|
590
590
|
}, { internal: true });
|
|
591
591
|
} catch {
|
|
592
592
|
}
|
|
@@ -70,7 +70,7 @@ class Response {
|
|
|
70
70
|
}
|
|
71
71
|
async finish() {
|
|
72
72
|
if (this._includeSnapshot !== "none" && this._context.currentTab())
|
|
73
|
-
this._tabSnapshot = await this._context.currentTabOrDie().captureSnapshot(
|
|
73
|
+
this._tabSnapshot = await this._context.currentTabOrDie().captureSnapshot();
|
|
74
74
|
for (const tab of this._context.tabs())
|
|
75
75
|
await tab.updateTitle();
|
|
76
76
|
}
|
|
@@ -105,7 +105,8 @@ ${this._code.join("\n")}
|
|
|
105
105
|
response.push(...(0, import_tab.renderModalStates)(this._context, this._tabSnapshot.modalStates));
|
|
106
106
|
response.push("");
|
|
107
107
|
} else if (this._tabSnapshot) {
|
|
108
|
-
|
|
108
|
+
const includeSnapshot = options.omitSnapshot ? "none" : this._includeSnapshot;
|
|
109
|
+
response.push(renderTabSnapshot(this._tabSnapshot, includeSnapshot));
|
|
109
110
|
response.push("");
|
|
110
111
|
}
|
|
111
112
|
const content = [
|
|
@@ -129,7 +130,7 @@ ${this._code.join("\n")}
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
function renderTabSnapshot(tabSnapshot,
|
|
133
|
+
function renderTabSnapshot(tabSnapshot, includeSnapshot) {
|
|
133
134
|
const lines = [];
|
|
134
135
|
if (tabSnapshot.consoleMessages.length) {
|
|
135
136
|
lines.push(`### New console messages`);
|
|
@@ -147,13 +148,21 @@ function renderTabSnapshot(tabSnapshot, options = {}) {
|
|
|
147
148
|
}
|
|
148
149
|
lines.push("");
|
|
149
150
|
}
|
|
151
|
+
if (includeSnapshot === "incremental" && tabSnapshot.ariaSnapshotDiff === "") {
|
|
152
|
+
return lines.join("\n");
|
|
153
|
+
}
|
|
150
154
|
lines.push(`### Page state`);
|
|
151
155
|
lines.push(`- Page URL: ${tabSnapshot.url}`);
|
|
152
156
|
lines.push(`- Page Title: ${tabSnapshot.title}`);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
+
if (includeSnapshot !== "none") {
|
|
158
|
+
lines.push(`- Page Snapshot:`);
|
|
159
|
+
lines.push("```yaml");
|
|
160
|
+
if (includeSnapshot === "incremental" && tabSnapshot.ariaSnapshotDiff !== void 0)
|
|
161
|
+
lines.push(tabSnapshot.ariaSnapshotDiff);
|
|
162
|
+
else
|
|
163
|
+
lines.push(tabSnapshot.ariaSnapshot);
|
|
164
|
+
lines.push("```");
|
|
165
|
+
}
|
|
157
166
|
return lines.join("\n");
|
|
158
167
|
}
|
|
159
168
|
function renderTabsMarkdown(tabs, force = false) {
|
package/lib/mcp/browser/tab.js
CHANGED
|
@@ -41,6 +41,7 @@ class Tab extends import_events.EventEmitter {
|
|
|
41
41
|
this._requests = /* @__PURE__ */ new Set();
|
|
42
42
|
this._modalStates = [];
|
|
43
43
|
this._downloads = [];
|
|
44
|
+
this._needsFullSnapshot = false;
|
|
44
45
|
this.context = context;
|
|
45
46
|
this.page = page;
|
|
46
47
|
this._onPageClose = onPageClose;
|
|
@@ -172,14 +173,15 @@ class Tab extends import_events.EventEmitter {
|
|
|
172
173
|
await this._initializedPromise;
|
|
173
174
|
return this._requests;
|
|
174
175
|
}
|
|
175
|
-
async captureSnapshot(
|
|
176
|
+
async captureSnapshot() {
|
|
176
177
|
let tabSnapshot;
|
|
177
178
|
const modalStates = await this._raceAgainstModalStates(async () => {
|
|
178
|
-
const snapshot = await this.page._snapshotForAI({
|
|
179
|
+
const snapshot = await this.page._snapshotForAI({ track: "response" });
|
|
179
180
|
tabSnapshot = {
|
|
180
181
|
url: this.page.url(),
|
|
181
182
|
title: await this.page.title(),
|
|
182
|
-
ariaSnapshot: snapshot,
|
|
183
|
+
ariaSnapshot: snapshot.full,
|
|
184
|
+
ariaSnapshotDiff: this._needsFullSnapshot ? void 0 : snapshot.incremental,
|
|
183
185
|
modalStates: [],
|
|
184
186
|
consoleMessages: [],
|
|
185
187
|
downloads: this._downloads
|
|
@@ -189,6 +191,7 @@ class Tab extends import_events.EventEmitter {
|
|
|
189
191
|
tabSnapshot.consoleMessages = this._recentConsoleMessages;
|
|
190
192
|
this._recentConsoleMessages = [];
|
|
191
193
|
}
|
|
194
|
+
this._needsFullSnapshot = !tabSnapshot;
|
|
192
195
|
return tabSnapshot ?? {
|
|
193
196
|
url: this.page.url(),
|
|
194
197
|
title: "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright",
|
|
3
|
-
"version": "1.57.0-alpha-
|
|
3
|
+
"version": "1.57.0-alpha-1761929702000",
|
|
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.57.0-alpha-
|
|
67
|
+
"playwright-core": "1.57.0-alpha-1761929702000"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
70
|
"fsevents": "2.3.2"
|