playwright 1.57.0-alpha-1760728340000 → 1.57.0-alpha-2025-10-18
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/agents/generateAgents.js +54 -51
- package/lib/agents/{planner.md → planner.agent.md} +4 -0
- package/lib/agents/test-coverage.prompt.md +31 -0
- package/lib/agents/test-generate.prompt.md +8 -0
- package/lib/agents/test-heal.prompt.md +6 -0
- package/lib/agents/test-plan.prompt.md +9 -0
- package/lib/mcp/browser/context.js +13 -0
- package/lib/mcp/browser/tools/headers.js +51 -0
- package/lib/mcp/browser/tools.js +2 -0
- package/lib/mcp/program.js +1 -1
- package/package.json +2 -2
- /package/lib/agents/{generator.md → generator.agent.md} +0 -0
- /package/lib/agents/{healer.md → healer.agent.md} +0 -0
|
@@ -42,7 +42,7 @@ var import_seed = require("../mcp/test/seed");
|
|
|
42
42
|
class AgentParser {
|
|
43
43
|
static async loadAgents() {
|
|
44
44
|
const files = await import_fs.default.promises.readdir(__dirname);
|
|
45
|
-
return Promise.all(files.filter((file) => file.endsWith(".md")).map((file) => AgentParser.parseFile(import_path.default.join(__dirname, file))));
|
|
45
|
+
return Promise.all(files.filter((file) => file.endsWith(".agent.md")).map((file) => AgentParser.parseFile(import_path.default.join(__dirname, file))));
|
|
46
46
|
}
|
|
47
47
|
static async parseFile(filePath) {
|
|
48
48
|
const source = await import_fs.default.promises.readFile(filePath, "utf-8");
|
|
@@ -93,11 +93,13 @@ class AgentParser {
|
|
|
93
93
|
}
|
|
94
94
|
class ClaudeGenerator {
|
|
95
95
|
static async init(config, projectName) {
|
|
96
|
-
await initRepo(config, projectName
|
|
96
|
+
await initRepo(config, projectName, {
|
|
97
|
+
promptsFolder: ".claude/prompts"
|
|
98
|
+
});
|
|
97
99
|
const agents = await AgentParser.loadAgents();
|
|
98
100
|
await import_fs.default.promises.mkdir(".claude/agents", { recursive: true });
|
|
99
101
|
for (const agent of agents)
|
|
100
|
-
await writeFile(`.claude/agents/${agent.header.name}.md`, ClaudeGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
|
102
|
+
await writeFile(`.claude/agents/${agent.header.name}.agent.md`, ClaudeGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
|
101
103
|
await writeFile(".mcp.json", JSON.stringify({
|
|
102
104
|
mcpServers: {
|
|
103
105
|
"playwright-test": {
|
|
@@ -136,14 +138,16 @@ class ClaudeGenerator {
|
|
|
136
138
|
}
|
|
137
139
|
class OpencodeGenerator {
|
|
138
140
|
static async init(config, projectName) {
|
|
139
|
-
await initRepo(config, projectName
|
|
141
|
+
await initRepo(config, projectName, {
|
|
142
|
+
agentDefault: "Build",
|
|
143
|
+
promptsFolder: ".opencode/prompts"
|
|
144
|
+
});
|
|
140
145
|
const agents = await AgentParser.loadAgents();
|
|
141
|
-
await import_fs.default.promises.mkdir(".opencode/prompts", { recursive: true });
|
|
142
146
|
for (const agent of agents) {
|
|
143
147
|
const prompt = [agent.instructions];
|
|
144
148
|
prompt.push("");
|
|
145
149
|
prompt.push(...agent.examples.map((example) => `<example>${example}</example>`));
|
|
146
|
-
await writeFile(`.opencode/prompts/${agent.header.name}.md`, prompt.join("\n"), "\u{1F916}", "agent definition");
|
|
150
|
+
await writeFile(`.opencode/prompts/${agent.header.name}.agent.md`, prompt.join("\n"), "\u{1F916}", "agent definition");
|
|
147
151
|
}
|
|
148
152
|
await writeFile("opencode.json", OpencodeGenerator.configuration(agents), "\u{1F527}", "opencode configuration");
|
|
149
153
|
initRepoDone();
|
|
@@ -176,7 +180,7 @@ class OpencodeGenerator {
|
|
|
176
180
|
result["agent"][agent.header.name] = {
|
|
177
181
|
description: agent.header.description,
|
|
178
182
|
mode: "subagent",
|
|
179
|
-
prompt: `{file:.opencode/prompts/${agent.header.name}.md}`,
|
|
183
|
+
prompt: `{file:.opencode/prompts/${agent.header.name}.agent.md}`,
|
|
180
184
|
tools
|
|
181
185
|
};
|
|
182
186
|
for (const tool of agent.header.tools)
|
|
@@ -197,7 +201,9 @@ class AgentGenerator {
|
|
|
197
201
|
console.error("AGENTS_FOLDER environment variable is not set");
|
|
198
202
|
return;
|
|
199
203
|
}
|
|
200
|
-
await initRepo(config, projectName
|
|
204
|
+
await initRepo(config, projectName, {
|
|
205
|
+
promptsFolder: import_path.default.join(agentsFolder, "prompts")
|
|
206
|
+
});
|
|
201
207
|
const agents = await AgentParser.loadAgents();
|
|
202
208
|
await import_fs.default.promises.mkdir(agentsFolder, { recursive: true });
|
|
203
209
|
for (const agent of agents)
|
|
@@ -224,13 +230,20 @@ class AgentGenerator {
|
|
|
224
230
|
}
|
|
225
231
|
class VSCodeGenerator {
|
|
226
232
|
static async init(config, projectName) {
|
|
227
|
-
await initRepo(config, projectName
|
|
233
|
+
await initRepo(config, projectName, {
|
|
234
|
+
agentDefault: "agent",
|
|
235
|
+
agentHealer: "\u{1F3AD} healer",
|
|
236
|
+
agentGenerator: "\u{1F3AD} generator",
|
|
237
|
+
agentPlanner: "\u{1F3AD} planner",
|
|
238
|
+
promptsFolder: ".github/prompts"
|
|
239
|
+
});
|
|
228
240
|
const agents = await AgentParser.loadAgents();
|
|
229
241
|
const nameMap = /* @__PURE__ */ new Map([
|
|
230
|
-
["playwright-test-planner", "
|
|
242
|
+
["playwright-test-planner", "\u{1F3AD} planner"],
|
|
231
243
|
["playwright-test-generator", "\u{1F3AD} generator"],
|
|
232
244
|
["playwright-test-healer", "\u{1F3AD} healer"]
|
|
233
245
|
]);
|
|
246
|
+
await deleteFile(`.github/chatmodes/ \u{1F3AD} planner.chatmode.md`, "old planner chatmode");
|
|
234
247
|
await import_fs.default.promises.mkdir(".github/chatmodes", { recursive: true });
|
|
235
248
|
for (const agent of agents)
|
|
236
249
|
await writeFile(`.github/chatmodes/${nameMap.get(agent.header.name)}.chatmode.md`, VSCodeGenerator.agentSpec(agent), "\u{1F916}", "chatmode definition");
|
|
@@ -297,7 +310,17 @@ async function writeFile(filePath, content, icon, description) {
|
|
|
297
310
|
await (0, import_utils.mkdirIfNeeded)(filePath);
|
|
298
311
|
await import_fs.default.promises.writeFile(filePath, content, "utf-8");
|
|
299
312
|
}
|
|
300
|
-
async function
|
|
313
|
+
async function deleteFile(filePath, description) {
|
|
314
|
+
try {
|
|
315
|
+
if (!import_fs.default.existsSync(filePath))
|
|
316
|
+
return;
|
|
317
|
+
} catch {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
console.log(`- \u2702\uFE0F ${import_path.default.relative(process.cwd(), filePath)} ${import_utilsBundle.colors.dim("- " + description)}`);
|
|
321
|
+
await import_fs.default.promises.unlink(filePath);
|
|
322
|
+
}
|
|
323
|
+
async function initRepo(config, projectName, options) {
|
|
301
324
|
const project = (0, import_seed.seedProject)(config, projectName);
|
|
302
325
|
console.log(`\u{1F3AD} Using project "${project.project.name}" as a primary project`);
|
|
303
326
|
if (!import_fs.default.existsSync("specs")) {
|
|
@@ -306,56 +329,36 @@ async function initRepo(config, projectName) {
|
|
|
306
329
|
|
|
307
330
|
This is a directory for test plans.
|
|
308
331
|
`, "\u{1F4DD}", "directory for test plans");
|
|
309
|
-
}
|
|
310
|
-
if (!import_fs.default.existsSync("prompts")) {
|
|
311
|
-
await import_fs.default.promises.mkdir("prompts");
|
|
312
|
-
await writeFile(import_path.default.join("prompts", "README.md"), `# Prompts
|
|
313
|
-
|
|
314
|
-
This is a directory for useful prompts.
|
|
315
|
-
`, "\u{1F4DD}", "useful prompts");
|
|
316
332
|
}
|
|
317
333
|
let seedFile = await (0, import_seed.findSeedFile)(project);
|
|
318
334
|
if (!seedFile) {
|
|
319
335
|
seedFile = (0, import_seed.defaultSeedFile)(project);
|
|
320
336
|
await writeFile(seedFile, import_seed.seedFileContent, "\u{1F331}", "default environment seed file");
|
|
321
337
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
338
|
+
await import_fs.default.promises.mkdir(options.promptsFolder, { recursive: true });
|
|
339
|
+
for (const promptFile of await import_fs.default.promises.readdir(__dirname)) {
|
|
340
|
+
if (!promptFile.endsWith(".prompt.md"))
|
|
341
|
+
continue;
|
|
342
|
+
const content = await loadPrompt(promptFile, { ...options, seedFile: import_path.default.relative(process.cwd(), seedFile) });
|
|
343
|
+
await writeFile(import_path.default.join(options.promptsFolder, promptFile), content, "\u{1F4DD}", "prompt template");
|
|
344
|
+
}
|
|
325
345
|
}
|
|
326
346
|
function initRepoDone() {
|
|
327
347
|
console.log("\u2705 Done.");
|
|
328
348
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
<plan-file><!-- test plan file --></plan-file>
|
|
343
|
-
</plan>
|
|
344
|
-
|
|
345
|
-
2. For each test case from the test plan file (1.1, 1.2, ...), Call #playwright-test-generator subagent with prompt:
|
|
346
|
-
|
|
347
|
-
<generate>
|
|
348
|
-
<test-file><!-- Name of the file to save the test into, should be unique for test --></test-file>
|
|
349
|
-
<test-suite><!-- Name of the top level test spec w/o ordinal--></test-suite>
|
|
350
|
-
<test-name><!--Name of the test case without the ordinal --></test-name>
|
|
351
|
-
<seed-file><!-- Seed file from test plan --></seed-file>
|
|
352
|
-
<body><!-- Test case content including steps and expectations --></body>
|
|
353
|
-
</generate>
|
|
354
|
-
|
|
355
|
-
3. Call #playwright-test-healer subagent with prompt:
|
|
356
|
-
|
|
357
|
-
<heal>Run all tests and fix the failing ones one after another.</heal>
|
|
358
|
-
`;
|
|
349
|
+
async function loadPrompt(file, params) {
|
|
350
|
+
const templateParams = {
|
|
351
|
+
agentDefault: params.agentDefault ?? "default",
|
|
352
|
+
agentHealer: params.agentHealer ?? "playwright-test-healer",
|
|
353
|
+
agentGenerator: params.agentGenerator ?? "playwright-test-generator",
|
|
354
|
+
agentPlanner: params.agentPlanner ?? "playwright-test-planner",
|
|
355
|
+
seedFile: params.seedFile
|
|
356
|
+
};
|
|
357
|
+
const content = await import_fs.default.promises.readFile(import_path.default.join(__dirname, file), "utf-8");
|
|
358
|
+
return Object.entries(templateParams).reduce((acc, [key, value]) => {
|
|
359
|
+
return acc.replace(new RegExp(`\\\${${key}}`, "g"), value);
|
|
360
|
+
}, content);
|
|
361
|
+
}
|
|
359
362
|
// Annotate the CommonJS export names for ESM import in node:
|
|
360
363
|
0 && (module.exports = {
|
|
361
364
|
AgentGenerator,
|
|
@@ -66,6 +66,7 @@ You will:
|
|
|
66
66
|
- Executive summary of the tested page/application
|
|
67
67
|
- Individual scenarios as separate sections
|
|
68
68
|
- Each scenario formatted with numbered steps
|
|
69
|
+
- Each test case with proposed file name for implementation
|
|
69
70
|
- Clear expected results for verification
|
|
70
71
|
|
|
71
72
|
<example-spec>
|
|
@@ -90,6 +91,9 @@ application features:
|
|
|
90
91
|
**Seed:** `tests/seed.spec.ts`
|
|
91
92
|
|
|
92
93
|
#### 1.1 Add Valid Todo
|
|
94
|
+
|
|
95
|
+
**File** `tests/adding-new-todos/add-valid-todo.spec.ts`
|
|
96
|
+
|
|
93
97
|
**Steps:**
|
|
94
98
|
1. Click in the "What needs to be done?" input field
|
|
95
99
|
2. Type "Buy groceries"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: ${agentDefault}
|
|
3
|
+
description: Produce test coverage
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Parameters:
|
|
7
|
+
- Task: the task to perform
|
|
8
|
+
- Seed file (optional): the seed file to use, defaults to `${seedFile}`
|
|
9
|
+
- Test plan file (optional): the test plan file to write, under `specs/` folder.
|
|
10
|
+
|
|
11
|
+
1. Call #${agentPlanner} subagent with prompt:
|
|
12
|
+
|
|
13
|
+
<plan>
|
|
14
|
+
<task-text><!-- the task --></task-text>
|
|
15
|
+
<seed-file><!-- path to seed file --></seed-file>
|
|
16
|
+
<plan-file><!-- path to test plan file to generate --></plan-file>
|
|
17
|
+
</plan>
|
|
18
|
+
|
|
19
|
+
2. For each test case from the test plan file (1.1, 1.2, ...), one after another, not in parallel, call #${agentGenerator} subagent with prompt:
|
|
20
|
+
|
|
21
|
+
<generate>
|
|
22
|
+
<test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite>
|
|
23
|
+
<test-name><!-- Name of the test case without the ordinal like "should add two numbers" --></test-name>
|
|
24
|
+
<test-file><!-- Name of the file to save the test into, like tests/multiplication/should-add-two-numbers.spec.ts --></test-file>
|
|
25
|
+
<seed-file><!-- Seed file path from test plan --></seed-file>
|
|
26
|
+
<body><!-- Test case content including steps and expectations --></body>
|
|
27
|
+
</generate>
|
|
28
|
+
|
|
29
|
+
3. Call #${agentHealer} subagent with prompt:
|
|
30
|
+
|
|
31
|
+
<heal>Run all tests and fix the failing ones one after another.</heal>
|
|
@@ -183,6 +183,17 @@ class Context {
|
|
|
183
183
|
const { browserContext } = await this._ensureBrowserContext();
|
|
184
184
|
return browserContext;
|
|
185
185
|
}
|
|
186
|
+
async setExtraHTTPHeaders(headers) {
|
|
187
|
+
if (!Object.keys(headers).length)
|
|
188
|
+
throw new Error("Please provide at least one header to set.");
|
|
189
|
+
for (const name of Object.keys(headers)) {
|
|
190
|
+
if (!name.trim())
|
|
191
|
+
throw new Error("Header names must be non-empty strings.");
|
|
192
|
+
}
|
|
193
|
+
this._extraHTTPHeaders = { ...headers };
|
|
194
|
+
const { browserContext } = await this._ensureBrowserContext();
|
|
195
|
+
await browserContext.setExtraHTTPHeaders(this._extraHTTPHeaders);
|
|
196
|
+
}
|
|
186
197
|
_ensureBrowserContext() {
|
|
187
198
|
if (!this._browserContextPromise) {
|
|
188
199
|
this._browserContextPromise = this._setupBrowserContext();
|
|
@@ -200,6 +211,8 @@ class Context {
|
|
|
200
211
|
const result = await this._browserContextFactory.createContext(this._clientInfo, this._abortController.signal, this._runningToolName);
|
|
201
212
|
const { browserContext } = result;
|
|
202
213
|
await this._setupRequestInterception(browserContext);
|
|
214
|
+
if (this._extraHTTPHeaders)
|
|
215
|
+
await browserContext.setExtraHTTPHeaders(this._extraHTTPHeaders);
|
|
203
216
|
if (this.sessionLog)
|
|
204
217
|
await InputRecorder.create(this, browserContext);
|
|
205
218
|
for (const page of browserContext.pages())
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var headers_exports = {};
|
|
20
|
+
__export(headers_exports, {
|
|
21
|
+
default: () => headers_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(headers_exports);
|
|
24
|
+
var import_bundle = require("../../sdk/bundle");
|
|
25
|
+
var import_tool = require("./tool");
|
|
26
|
+
const setHeaders = (0, import_tool.defineTool)({
|
|
27
|
+
capability: "headers",
|
|
28
|
+
schema: {
|
|
29
|
+
name: "browser_set_headers",
|
|
30
|
+
title: "Set extra HTTP headers",
|
|
31
|
+
description: "Persistently set custom HTTP headers on the active browser context.",
|
|
32
|
+
inputSchema: import_bundle.z.object({
|
|
33
|
+
headers: import_bundle.z.record(import_bundle.z.string(), import_bundle.z.string()).describe("Header names mapped to the values that should be sent with every request.")
|
|
34
|
+
}),
|
|
35
|
+
type: "action"
|
|
36
|
+
},
|
|
37
|
+
handle: async (context, params, response) => {
|
|
38
|
+
try {
|
|
39
|
+
await context.setExtraHTTPHeaders(params.headers);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
response.addError(error.message);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const count = Object.keys(params.headers).length;
|
|
45
|
+
response.addResult(`Configured ${count} ${count === 1 ? "header" : "headers"} for this session.`);
|
|
46
|
+
response.addCode(`await context.setExtraHTTPHeaders(${JSON.stringify(params.headers, null, 2)});`);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var headers_default = [
|
|
50
|
+
setHeaders
|
|
51
|
+
];
|
package/lib/mcp/browser/tools.js
CHANGED
|
@@ -44,6 +44,7 @@ var import_mouse = __toESM(require("./tools/mouse"));
|
|
|
44
44
|
var import_navigate = __toESM(require("./tools/navigate"));
|
|
45
45
|
var import_network = __toESM(require("./tools/network"));
|
|
46
46
|
var import_pdf = __toESM(require("./tools/pdf"));
|
|
47
|
+
var import_headers = __toESM(require("./tools/headers"));
|
|
47
48
|
var import_snapshot = __toESM(require("./tools/snapshot"));
|
|
48
49
|
var import_screenshot = __toESM(require("./tools/screenshot"));
|
|
49
50
|
var import_tabs = __toESM(require("./tools/tabs"));
|
|
@@ -61,6 +62,7 @@ const browserTools = [
|
|
|
61
62
|
...import_keyboard.default,
|
|
62
63
|
...import_navigate.default,
|
|
63
64
|
...import_network.default,
|
|
65
|
+
...import_headers.default,
|
|
64
66
|
...import_mouse.default,
|
|
65
67
|
...import_pdf.default,
|
|
66
68
|
...import_screenshot.default,
|
package/lib/mcp/program.js
CHANGED
|
@@ -40,7 +40,7 @@ var import_proxyBackend = require("./sdk/proxyBackend");
|
|
|
40
40
|
var import_browserServerBackend = require("./browser/browserServerBackend");
|
|
41
41
|
var import_extensionContextFactory = require("./extension/extensionContextFactory");
|
|
42
42
|
function decorateCommand(command, version) {
|
|
43
|
-
command.option("--allowed-hosts <hosts...>", "comma-separated list of hosts this server is allowed to serve from. Defaults to the host the server is bound to. Pass '*' to disable the host check.", import_config.commaSeparatedList).option("--allowed-origins <origins>", "semicolon-separated list of origins to allow the browser to request. Default is to allow all.", import_config.semicolonSeparatedList).option("--blocked-origins <origins>", "semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed.", import_config.semicolonSeparatedList).option("--block-service-workers", "block service workers").option("--browser <browser>", "browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.").option("--caps <caps>", "comma-separated list of additional capabilities to enable, possible values: vision, pdf.", import_config.commaSeparatedList).option("--cdp-endpoint <endpoint>", "CDP endpoint to connect to.").option("--cdp-header <headers...>", "CDP headers to send with the connect request, multiple can be specified.", import_config.headerParser).option("--config <path>", "path to the configuration file.").option("--device <device>", 'device to emulate, for example: "iPhone 15"').option("--executable-path <path>", "path to the browser executable.").option("--extension", 'Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright MCP Bridge" browser extension to be installed.').option("--grant-permissions <permissions...>", 'List of permissions to grant to the browser context, for example "geolocation", "clipboard-read", "clipboard-write".', import_config.commaSeparatedList).option("--headless", "run browser in headless mode, headed by default").option("--host <host>", "host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.").option("--ignore-https-errors", "ignore https errors").option("--init-script <path...>", "path to JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page's scripts. Can be specified multiple times.").option("--isolated", "keep the browser profile in memory, do not save it to disk.").option("--image-responses <mode>", 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".').option("--no-sandbox", "disable the sandbox for all process types that are normally sandboxed.").option("--output-dir <path>", "path to the directory for output files.").option("--port <port>", "port to listen on for SSE transport.").option("--proxy-bypass <bypass>", 'comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"').option("--proxy-server <proxy>", 'specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"').option("--save-session", "Whether to save the Playwright MCP session into the output directory.").option("--save-trace", "Whether to save the Playwright Trace of the session into the output directory.").option("--save-video <size>", 'Whether to save the video of the session into the output directory. For example "--save-video=800x600"', import_config.resolutionParser.bind(null, "--save-video")).option("--secrets <path>", "path to a file containing secrets in the dotenv format", import_config.dotenvFileLoader).option("--shared-browser-context", "reuse the same browser context between all connected HTTP clients.").option("--storage-state <path>", "path to the storage state file for isolated sessions.").option("--test-id-attribute <attribute>", 'specify the attribute to use for test ids, defaults to "data-testid"').option("--timeout-action <timeout>", "specify action timeout in milliseconds, defaults to 5000ms", import_config.numberParser).option("--timeout-navigation <timeout>", "specify navigation timeout in milliseconds, defaults to 60000ms", import_config.numberParser).option("--user-agent <ua string>", "specify user agent string").option("--user-data-dir <path>", "path to the user data directory. If not specified, a temporary directory will be created.").option("--viewport-size <size>", 'specify browser viewport size in pixels, for example "1280x720"', import_config.resolutionParser.bind(null, "--viewport-size")).addOption(new import_utilsBundle.ProgramOption("--connect-tool", "Allow to switch between different browser connection methods.").hideHelp()).addOption(new import_utilsBundle.ProgramOption("--vision", "Legacy option, use --caps=vision instead").hideHelp()).action(async (options) => {
|
|
43
|
+
command.option("--allowed-hosts <hosts...>", "comma-separated list of hosts this server is allowed to serve from. Defaults to the host the server is bound to. Pass '*' to disable the host check.", import_config.commaSeparatedList).option("--allowed-origins <origins>", "semicolon-separated list of origins to allow the browser to request. Default is to allow all.", import_config.semicolonSeparatedList).option("--blocked-origins <origins>", "semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed.", import_config.semicolonSeparatedList).option("--block-service-workers", "block service workers").option("--browser <browser>", "browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.").option("--caps <caps>", "comma-separated list of additional capabilities to enable, possible values: vision, pdf, headers.", import_config.commaSeparatedList).option("--cdp-endpoint <endpoint>", "CDP endpoint to connect to.").option("--cdp-header <headers...>", "CDP headers to send with the connect request, multiple can be specified.", import_config.headerParser).option("--config <path>", "path to the configuration file.").option("--device <device>", 'device to emulate, for example: "iPhone 15"').option("--executable-path <path>", "path to the browser executable.").option("--extension", 'Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright MCP Bridge" browser extension to be installed.').option("--grant-permissions <permissions...>", 'List of permissions to grant to the browser context, for example "geolocation", "clipboard-read", "clipboard-write".', import_config.commaSeparatedList).option("--headless", "run browser in headless mode, headed by default").option("--host <host>", "host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.").option("--ignore-https-errors", "ignore https errors").option("--init-script <path...>", "path to JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page's scripts. Can be specified multiple times.").option("--isolated", "keep the browser profile in memory, do not save it to disk.").option("--image-responses <mode>", 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".').option("--no-sandbox", "disable the sandbox for all process types that are normally sandboxed.").option("--output-dir <path>", "path to the directory for output files.").option("--port <port>", "port to listen on for SSE transport.").option("--proxy-bypass <bypass>", 'comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"').option("--proxy-server <proxy>", 'specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"').option("--save-session", "Whether to save the Playwright MCP session into the output directory.").option("--save-trace", "Whether to save the Playwright Trace of the session into the output directory.").option("--save-video <size>", 'Whether to save the video of the session into the output directory. For example "--save-video=800x600"', import_config.resolutionParser.bind(null, "--save-video")).option("--secrets <path>", "path to a file containing secrets in the dotenv format", import_config.dotenvFileLoader).option("--shared-browser-context", "reuse the same browser context between all connected HTTP clients.").option("--storage-state <path>", "path to the storage state file for isolated sessions.").option("--test-id-attribute <attribute>", 'specify the attribute to use for test ids, defaults to "data-testid"').option("--timeout-action <timeout>", "specify action timeout in milliseconds, defaults to 5000ms", import_config.numberParser).option("--timeout-navigation <timeout>", "specify navigation timeout in milliseconds, defaults to 60000ms", import_config.numberParser).option("--user-agent <ua string>", "specify user agent string").option("--user-data-dir <path>", "path to the user data directory. If not specified, a temporary directory will be created.").option("--viewport-size <size>", 'specify browser viewport size in pixels, for example "1280x720"', import_config.resolutionParser.bind(null, "--viewport-size")).addOption(new import_utilsBundle.ProgramOption("--connect-tool", "Allow to switch between different browser connection methods.").hideHelp()).addOption(new import_utilsBundle.ProgramOption("--vision", "Legacy option, use --caps=vision instead").hideHelp()).action(async (options) => {
|
|
44
44
|
(0, import_watchdog.setupExitWatchdog)();
|
|
45
45
|
if (options.vision) {
|
|
46
46
|
console.error("The --vision option is deprecated, use --caps=vision instead");
|
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-2025-10-18",
|
|
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-2025-10-18"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
70
|
"fsevents": "2.3.2"
|
|
File without changes
|
|
File without changes
|