@playwright/mcp 0.0.22 → 0.0.25
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 +363 -186
- package/config.d.ts +6 -1
- package/index.js +1 -1
- package/lib/config.js +45 -5
- package/lib/connection.js +2 -2
- package/lib/context.js +50 -41
- package/lib/index.js +2 -1
- package/lib/pageSnapshot.js +8 -55
- package/lib/program.js +22 -13
- package/lib/tab.js +6 -9
- package/lib/tools/common.js +1 -22
- package/lib/tools/console.js +1 -1
- package/lib/tools/install.js +1 -1
- package/lib/tools/pdf.js +6 -3
- package/lib/tools/screenshot.js +77 -0
- package/lib/tools/snapshot.js +1 -58
- package/lib/tools/utils.js +3 -0
- package/lib/tools/wait.js +59 -0
- package/lib/tools.js +8 -3
- package/package.json +3 -4
- /package/lib/tools/{screen.js → vision.js} +0 -0
package/README.md
CHANGED
|
@@ -4,25 +4,22 @@ A Model Context Protocol (MCP) server that provides browser automation capabilit
|
|
|
4
4
|
|
|
5
5
|
### Key Features
|
|
6
6
|
|
|
7
|
-
- **Fast and lightweight
|
|
8
|
-
- **LLM-friendly
|
|
9
|
-
- **Deterministic tool application
|
|
7
|
+
- **Fast and lightweight**. Uses Playwright's accessibility tree, not pixel-based input.
|
|
8
|
+
- **LLM-friendly**. No vision models needed, operates purely on structured data.
|
|
9
|
+
- **Deterministic tool application**. Avoids ambiguity common with screenshot-based approaches.
|
|
10
10
|
|
|
11
|
-
###
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
- Data extraction from structured content
|
|
15
|
-
- Automated testing driven by LLMs
|
|
16
|
-
- General-purpose browser interaction for agents
|
|
11
|
+
### Requirements
|
|
12
|
+
- Node.js 18 or newer
|
|
13
|
+
- VS Code, Cursor, Windsurf, Claude Desktop or any other MCP client
|
|
17
14
|
|
|
18
15
|
<!--
|
|
19
16
|
// Generate using:
|
|
20
17
|
node utils/generate-links.js
|
|
21
18
|
-->
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
### Getting started
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
First, install the Playwright MCP server with your client. A typical configuration looks like this:
|
|
26
23
|
|
|
27
24
|
```js
|
|
28
25
|
{
|
|
@@ -37,20 +34,12 @@ node utils/generate-links.js
|
|
|
37
34
|
}
|
|
38
35
|
```
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
[<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540playwright%252Fmcp%2540latest%2522%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540playwright%252Fmcp%2540latest%2522%255D%257D)
|
|
41
38
|
|
|
42
|
-
- [Installation in VS Code](#installation-in-vs-code)
|
|
43
|
-
- [Command line](#command-line)
|
|
44
|
-
- [User profile](#user-profile)
|
|
45
|
-
- [Configuration file](#configuration-file)
|
|
46
|
-
- [Running on Linux](#running-on-linux)
|
|
47
|
-
- [Docker](#docker)
|
|
48
|
-
- [Programmatic usage](#programmatic-usage)
|
|
49
|
-
- [Tool modes](#tool-modes)
|
|
50
39
|
|
|
51
|
-
|
|
40
|
+
<details><summary><b>Install in VS Code</b></summary>
|
|
52
41
|
|
|
53
|
-
You can install the Playwright MCP server using the VS Code CLI:
|
|
42
|
+
You can also install the Playwright MCP server using the VS Code CLI:
|
|
54
43
|
|
|
55
44
|
```bash
|
|
56
45
|
# For VS Code
|
|
@@ -58,45 +47,171 @@ code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@la
|
|
|
58
47
|
```
|
|
59
48
|
|
|
60
49
|
After installation, the Playwright MCP server will be available for use with your GitHub Copilot agent in VS Code.
|
|
50
|
+
</details>
|
|
61
51
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
The Playwright MCP server supports the following command-line options:
|
|
65
|
-
|
|
66
|
-
- `--browser <browser>`: Browser or chrome channel to use. Possible values:
|
|
67
|
-
- `chrome`, `firefox`, `webkit`, `msedge`
|
|
68
|
-
- Chrome channels: `chrome-beta`, `chrome-canary`, `chrome-dev`
|
|
69
|
-
- Edge channels: `msedge-beta`, `msedge-canary`, `msedge-dev`
|
|
70
|
-
- Default: `chrome`
|
|
71
|
-
- `--caps <caps>`: Comma-separated list of capabilities to enable, possible values: tabs, pdf, history, wait, files, install. Default is all.
|
|
72
|
-
- `--cdp-endpoint <endpoint>`: CDP endpoint to connect to
|
|
73
|
-
- `--executable-path <path>`: Path to the browser executable
|
|
74
|
-
- `--headless`: Run browser in headless mode (headed by default)
|
|
75
|
-
- `--device`: Emulate mobile device
|
|
76
|
-
- `--user-data-dir <path>`: Path to the user data directory
|
|
77
|
-
- `--port <port>`: Port to listen on for SSE transport
|
|
78
|
-
- `--host <host>`: Host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.
|
|
79
|
-
- `--allowed-origins <origins>`: Semicolon-separated list of origins to allow the browser to request. Default is to allow all. Origins matching both `--allowed-origins` and `--blocked-origins` will be blocked.
|
|
80
|
-
- `--blocked-origins <origins>`: Semicolon-separated list of origins to block the browser to request. Origins matching both `--allowed-origins` and `--blocked-origins` will be blocked.
|
|
81
|
-
- `--vision`: Run server that uses screenshots (Aria snapshots are used by default)
|
|
82
|
-
- `--output-dir`: Directory for output files
|
|
83
|
-
- `--config <path>`: Path to the configuration file
|
|
52
|
+
<details>
|
|
53
|
+
<summary><b>Install in Cursor</b></summary>
|
|
84
54
|
|
|
85
|
-
|
|
55
|
+
Go to `Cursor Settings` -> `MCP` -> `Add new MCP Server`. Name to your liking, use `command` type with the command `npx @playwright/mcp`. You can also verify config or add command like arguments via clicking `Edit`.
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"playwright": {
|
|
61
|
+
"command": "npx",
|
|
62
|
+
"args": [
|
|
63
|
+
"@playwright/mcp@latest"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
</details>
|
|
70
|
+
|
|
71
|
+
<details>
|
|
72
|
+
<summary><b>Install in Windsurf</b></summary>
|
|
73
|
+
|
|
74
|
+
Follow Windsuff MCP [documentation](https://docs.windsurf.com/windsurf/cascade/mcp). Use following configuration:
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
{
|
|
78
|
+
"mcpServers": {
|
|
79
|
+
"playwright": {
|
|
80
|
+
"command": "npx",
|
|
81
|
+
"args": [
|
|
82
|
+
"@playwright/mcp@latest"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
</details>
|
|
89
|
+
|
|
90
|
+
<details>
|
|
91
|
+
<summary><b>Install in Claude Desktop</b></summary>
|
|
92
|
+
|
|
93
|
+
Follow the MCP install [guide](https://modelcontextprotocol.io/quickstart/user), use following configuration:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
{
|
|
97
|
+
"mcpServers": {
|
|
98
|
+
"playwright": {
|
|
99
|
+
"command": "npx",
|
|
100
|
+
"args": [
|
|
101
|
+
"@playwright/mcp@latest"
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
</details>
|
|
108
|
+
|
|
109
|
+
### Configuration
|
|
86
110
|
|
|
87
|
-
Playwright MCP
|
|
111
|
+
Playwright MCP server supports following arguments. They can be provided in the JSON configuration above, as a part of the `"args"` list:
|
|
112
|
+
|
|
113
|
+
<!--- Options generated by update-readme.js -->
|
|
88
114
|
|
|
89
115
|
```
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
|
|
116
|
+
> npx @playwright/mcp@latest --help
|
|
117
|
+
--allowed-origins <origins> semicolon-separated list of origins to allow the
|
|
118
|
+
browser to request. Default is to allow all.
|
|
119
|
+
--blocked-origins <origins> semicolon-separated list of origins to block the
|
|
120
|
+
browser from requesting. Blocklist is evaluated
|
|
121
|
+
before allowlist. If used without the allowlist,
|
|
122
|
+
requests not matching the blocklist are still
|
|
123
|
+
allowed.
|
|
124
|
+
--block-service-workers block service workers
|
|
125
|
+
--browser <browser> browser or chrome channel to use, possible
|
|
126
|
+
values: chrome, firefox, webkit, msedge.
|
|
127
|
+
--caps <caps> comma-separated list of capabilities to enable,
|
|
128
|
+
possible values: tabs, pdf, history, wait, files,
|
|
129
|
+
install. Default is all.
|
|
130
|
+
--cdp-endpoint <endpoint> CDP endpoint to connect to.
|
|
131
|
+
--config <path> path to the configuration file.
|
|
132
|
+
--device <device> device to emulate, for example: "iPhone 15"
|
|
133
|
+
--executable-path <path> path to the browser executable.
|
|
134
|
+
--headless run browser in headless mode, headed by default
|
|
135
|
+
--host <host> host to bind server to. Default is localhost. Use
|
|
136
|
+
0.0.0.0 to bind to all interfaces.
|
|
137
|
+
--ignore-https-errors ignore https errors
|
|
138
|
+
--isolated keep the browser profile in memory, do not save
|
|
139
|
+
it to disk.
|
|
140
|
+
--no-image-responses do not send image responses to the client.
|
|
141
|
+
--no-sandbox disable the sandbox for all process types that
|
|
142
|
+
are normally sandboxed.
|
|
143
|
+
--output-dir <path> path to the directory for output files.
|
|
144
|
+
--port <port> port to listen on for SSE transport.
|
|
145
|
+
--proxy-bypass <bypass> comma-separated domains to bypass proxy, for
|
|
146
|
+
example ".com,chromium.org,.domain.com"
|
|
147
|
+
--proxy-server <proxy> specify proxy server, for example
|
|
148
|
+
"http://myproxy:3128" or "socks5://myproxy:8080"
|
|
149
|
+
--storage-state <path> path to the storage state file for isolated
|
|
150
|
+
sessions.
|
|
151
|
+
--user-agent <ua string> specify user agent string
|
|
152
|
+
--user-data-dir <path> path to the user data directory. If not
|
|
153
|
+
specified, a temporary directory will be created.
|
|
154
|
+
--viewport-size <size> specify browser viewport size in pixels, for
|
|
155
|
+
example "1280, 720"
|
|
156
|
+
--vision Run server that uses screenshots (Aria snapshots
|
|
157
|
+
are used by default)
|
|
93
158
|
```
|
|
94
159
|
|
|
95
|
-
|
|
160
|
+
<!--- End of options generated section -->
|
|
161
|
+
|
|
162
|
+
### User profile
|
|
163
|
+
|
|
164
|
+
You can run Playwright MCP with persistent profile like a regular browser (default), or in the isolated contexts for the testing sessions.
|
|
165
|
+
|
|
166
|
+
**Persistent profile**
|
|
167
|
+
|
|
168
|
+
All the logged in information will be stored in the persistent profile, you can delete it between sessions if you'd like to clear the offline state.
|
|
169
|
+
Persistent profile is located at the following locations and you can override it with the `--user-data-dir` argument.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Windows
|
|
173
|
+
%USERPROFILE%\AppData\Local\ms-playwright\mcp-{channel}-profile
|
|
174
|
+
|
|
175
|
+
# macOS
|
|
176
|
+
- ~/Library/Caches/ms-playwright/mcp-{channel}-profile
|
|
177
|
+
|
|
178
|
+
# Linux
|
|
179
|
+
- ~/.cache/ms-playwright/mcp-{channel}-profile
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Isolated**
|
|
183
|
+
|
|
184
|
+
In the isolated mode, each session is started in the isolated profile. Every time you ask MCP to close the browser,
|
|
185
|
+
the session is closed and all the storage state for this session is lost. You can provide initial storage state
|
|
186
|
+
to the browser via the config's `contextOptions` or via the `--storage-state` argument. Learn more about the storage
|
|
187
|
+
state [here](https://playwright.dev/docs/auth).
|
|
188
|
+
|
|
189
|
+
```js
|
|
190
|
+
{
|
|
191
|
+
"mcpServers": {
|
|
192
|
+
"playwright": {
|
|
193
|
+
"command": "npx",
|
|
194
|
+
"args": [
|
|
195
|
+
"@playwright/mcp@latest",
|
|
196
|
+
"--isolated",
|
|
197
|
+
"--storage-state={path/to/storage.json}
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
96
203
|
|
|
97
204
|
### Configuration file
|
|
98
205
|
|
|
99
|
-
The Playwright MCP server can be configured using a JSON configuration file.
|
|
206
|
+
The Playwright MCP server can be configured using a JSON configuration file. You can specify the configuration file
|
|
207
|
+
using the `--config` command line option:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npx @playwright/mcp@latest --config path/to/config.json
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
<details>
|
|
214
|
+
<summary>Configuration file schema</summary>
|
|
100
215
|
|
|
101
216
|
```typescript
|
|
102
217
|
{
|
|
@@ -105,6 +220,9 @@ The Playwright MCP server can be configured using a JSON configuration file. Her
|
|
|
105
220
|
// Browser type to use (chromium, firefox, or webkit)
|
|
106
221
|
browserName?: 'chromium' | 'firefox' | 'webkit';
|
|
107
222
|
|
|
223
|
+
// Keep the browser profile in memory, do not save it to disk.
|
|
224
|
+
isolated?: boolean;
|
|
225
|
+
|
|
108
226
|
// Path to user data directory for browser profile persistence
|
|
109
227
|
userDataDir?: string;
|
|
110
228
|
|
|
@@ -170,14 +288,9 @@ The Playwright MCP server can be configured using a JSON configuration file. Her
|
|
|
170
288
|
noImageResponses?: boolean;
|
|
171
289
|
}
|
|
172
290
|
```
|
|
291
|
+
</details>
|
|
173
292
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
npx @playwright/mcp@latest --config path/to/config.json
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### Running on Linux
|
|
293
|
+
### Standalone MCP server
|
|
181
294
|
|
|
182
295
|
When running headed browser on system w/o display or from worker processes of the IDEs,
|
|
183
296
|
run the MCP server from environment with the DISPLAY and pass the `--port` flag to enable SSE transport.
|
|
@@ -198,7 +311,8 @@ And then in MCP client config, set the `url` to the SSE endpoint:
|
|
|
198
311
|
}
|
|
199
312
|
```
|
|
200
313
|
|
|
201
|
-
|
|
314
|
+
<details>
|
|
315
|
+
<summary><b>Docker</b></summary>
|
|
202
316
|
|
|
203
317
|
**NOTE:** The Docker implementation only supports headless chromium at the moment.
|
|
204
318
|
|
|
@@ -207,7 +321,7 @@ And then in MCP client config, set the `url` to the SSE endpoint:
|
|
|
207
321
|
"mcpServers": {
|
|
208
322
|
"playwright": {
|
|
209
323
|
"command": "docker",
|
|
210
|
-
"args": ["run", "-i", "--rm", "--init", "
|
|
324
|
+
"args": ["run", "-i", "--rm", "--init", "--pull=always", "mcr.microsoft.com/playwright/mcp"]
|
|
211
325
|
}
|
|
212
326
|
}
|
|
213
327
|
}
|
|
@@ -216,30 +330,33 @@ And then in MCP client config, set the `url` to the SSE endpoint:
|
|
|
216
330
|
You can build the Docker image yourself.
|
|
217
331
|
|
|
218
332
|
```
|
|
219
|
-
docker build -t
|
|
333
|
+
docker build -t mcr.microsoft.com/playwright/mcp .
|
|
220
334
|
```
|
|
335
|
+
</details>
|
|
221
336
|
|
|
222
|
-
|
|
337
|
+
<details>
|
|
338
|
+
<summary><b>Programmatic usage</b></summary>
|
|
223
339
|
|
|
224
340
|
```js
|
|
225
341
|
import http from 'http';
|
|
226
342
|
|
|
227
|
-
import {
|
|
343
|
+
import { createConnection } from '@playwright/mcp';
|
|
228
344
|
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
229
345
|
|
|
230
346
|
http.createServer(async (req, res) => {
|
|
231
347
|
// ...
|
|
232
348
|
|
|
233
349
|
// Creates a headless Playwright MCP server with SSE transport
|
|
234
|
-
const connection = await createConnection({ headless: true });
|
|
350
|
+
const connection = await createConnection({ browser: { launchOptions: { headless: true } } });
|
|
235
351
|
const transport = new SSEServerTransport('/messages', res);
|
|
236
352
|
await connection.connect(transport);
|
|
237
353
|
|
|
238
354
|
// ...
|
|
239
355
|
});
|
|
240
356
|
```
|
|
357
|
+
</details>
|
|
241
358
|
|
|
242
|
-
###
|
|
359
|
+
### Tools
|
|
243
360
|
|
|
244
361
|
The tools are available in two modes:
|
|
245
362
|
|
|
@@ -265,10 +382,10 @@ To use Vision Mode, add the `--vision` flag when starting the server:
|
|
|
265
382
|
Vision Mode works best with the computer use models that are able to interact with elements using
|
|
266
383
|
X Y coordinate space, based on the provided screenshot.
|
|
267
384
|
|
|
385
|
+
<!--- Tools generated by update-readme.js -->
|
|
268
386
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
### Snapshot-based Interactions
|
|
387
|
+
<details>
|
|
388
|
+
<summary><b>Interactions</b></summary>
|
|
272
389
|
|
|
273
390
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
274
391
|
|
|
@@ -336,71 +453,150 @@ X Y coordinate space, based on the provided screenshot.
|
|
|
336
453
|
|
|
337
454
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
338
455
|
|
|
456
|
+
- **browser_press_key**
|
|
457
|
+
- Title: Press a key
|
|
458
|
+
- Description: Press a key on the keyboard
|
|
459
|
+
- Parameters:
|
|
460
|
+
- `key` (string): Name of the key to press or a character to generate, such as `ArrowLeft` or `a`
|
|
461
|
+
- Read-only: **false**
|
|
462
|
+
|
|
463
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
464
|
+
|
|
465
|
+
- **browser_wait_for**
|
|
466
|
+
- Title: Wait for
|
|
467
|
+
- Description: Wait for text to appear or disappear or a specified time to pass
|
|
468
|
+
- Parameters:
|
|
469
|
+
- `time` (number, optional): The time to wait in seconds
|
|
470
|
+
- `text` (string, optional): The text to wait for
|
|
471
|
+
- `textGone` (string, optional): The text to wait for to disappear
|
|
472
|
+
- Read-only: **true**
|
|
473
|
+
|
|
474
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
475
|
+
|
|
476
|
+
- **browser_file_upload**
|
|
477
|
+
- Title: Upload files
|
|
478
|
+
- Description: Upload one or multiple files
|
|
479
|
+
- Parameters:
|
|
480
|
+
- `paths` (array): The absolute paths to the files to upload. Can be a single file or multiple files.
|
|
481
|
+
- Read-only: **false**
|
|
482
|
+
|
|
483
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
484
|
+
|
|
485
|
+
- **browser_handle_dialog**
|
|
486
|
+
- Title: Handle a dialog
|
|
487
|
+
- Description: Handle a dialog
|
|
488
|
+
- Parameters:
|
|
489
|
+
- `accept` (boolean): Whether to accept the dialog.
|
|
490
|
+
- `promptText` (string, optional): The text of the prompt in case of a prompt dialog.
|
|
491
|
+
- Read-only: **false**
|
|
492
|
+
|
|
493
|
+
</details>
|
|
494
|
+
|
|
495
|
+
<details>
|
|
496
|
+
<summary><b>Navigation</b></summary>
|
|
497
|
+
|
|
498
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
499
|
+
|
|
500
|
+
- **browser_navigate**
|
|
501
|
+
- Title: Navigate to a URL
|
|
502
|
+
- Description: Navigate to a URL
|
|
503
|
+
- Parameters:
|
|
504
|
+
- `url` (string): The URL to navigate to
|
|
505
|
+
- Read-only: **false**
|
|
506
|
+
|
|
507
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
508
|
+
|
|
509
|
+
- **browser_navigate_back**
|
|
510
|
+
- Title: Go back
|
|
511
|
+
- Description: Go back to the previous page
|
|
512
|
+
- Parameters: None
|
|
513
|
+
- Read-only: **true**
|
|
514
|
+
|
|
515
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
516
|
+
|
|
517
|
+
- **browser_navigate_forward**
|
|
518
|
+
- Title: Go forward
|
|
519
|
+
- Description: Go forward to the next page
|
|
520
|
+
- Parameters: None
|
|
521
|
+
- Read-only: **true**
|
|
522
|
+
|
|
523
|
+
</details>
|
|
524
|
+
|
|
525
|
+
<details>
|
|
526
|
+
<summary><b>Resources</b></summary>
|
|
527
|
+
|
|
528
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
529
|
+
|
|
339
530
|
- **browser_take_screenshot**
|
|
340
531
|
- Title: Take a screenshot
|
|
341
532
|
- Description: Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.
|
|
342
533
|
- Parameters:
|
|
343
534
|
- `raw` (boolean, optional): Whether to return without compression (in PNG format). Default is false, which returns a JPEG image.
|
|
535
|
+
- `filename` (string, optional): File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified.
|
|
344
536
|
- `element` (string, optional): Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too.
|
|
345
537
|
- `ref` (string, optional): Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too.
|
|
346
538
|
- Read-only: **true**
|
|
347
539
|
|
|
348
|
-
|
|
540
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
541
|
+
|
|
542
|
+
- **browser_pdf_save**
|
|
543
|
+
- Title: Save as PDF
|
|
544
|
+
- Description: Save page as PDF
|
|
545
|
+
- Parameters:
|
|
546
|
+
- `filename` (string, optional): File name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified.
|
|
547
|
+
- Read-only: **true**
|
|
349
548
|
|
|
350
549
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
351
550
|
|
|
352
|
-
- **
|
|
353
|
-
- Title:
|
|
354
|
-
- Description:
|
|
551
|
+
- **browser_network_requests**
|
|
552
|
+
- Title: List network requests
|
|
553
|
+
- Description: Returns all network requests since loading the page
|
|
355
554
|
- Parameters: None
|
|
356
555
|
- Read-only: **true**
|
|
357
556
|
|
|
358
557
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
359
558
|
|
|
360
|
-
- **
|
|
361
|
-
- Title:
|
|
362
|
-
- Description:
|
|
363
|
-
- Parameters:
|
|
364
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
365
|
-
- `x` (number): X coordinate
|
|
366
|
-
- `y` (number): Y coordinate
|
|
559
|
+
- **browser_console_messages**
|
|
560
|
+
- Title: Get console messages
|
|
561
|
+
- Description: Returns all console messages
|
|
562
|
+
- Parameters: None
|
|
367
563
|
- Read-only: **true**
|
|
368
564
|
|
|
565
|
+
</details>
|
|
566
|
+
|
|
567
|
+
<details>
|
|
568
|
+
<summary><b>Utilities</b></summary>
|
|
569
|
+
|
|
369
570
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
370
571
|
|
|
371
|
-
- **
|
|
372
|
-
- Title:
|
|
373
|
-
- Description:
|
|
374
|
-
- Parameters:
|
|
375
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
376
|
-
- `x` (number): X coordinate
|
|
377
|
-
- `y` (number): Y coordinate
|
|
572
|
+
- **browser_install**
|
|
573
|
+
- Title: Install the browser specified in the config
|
|
574
|
+
- Description: Install the browser specified in the config. Call this if you get an error about the browser not being installed.
|
|
575
|
+
- Parameters: None
|
|
378
576
|
- Read-only: **false**
|
|
379
577
|
|
|
380
578
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
381
579
|
|
|
382
|
-
- **
|
|
383
|
-
- Title:
|
|
384
|
-
- Description:
|
|
385
|
-
- Parameters:
|
|
386
|
-
|
|
387
|
-
- `startX` (number): Start X coordinate
|
|
388
|
-
- `startY` (number): Start Y coordinate
|
|
389
|
-
- `endX` (number): End X coordinate
|
|
390
|
-
- `endY` (number): End Y coordinate
|
|
391
|
-
- Read-only: **false**
|
|
580
|
+
- **browser_close**
|
|
581
|
+
- Title: Close browser
|
|
582
|
+
- Description: Close the page
|
|
583
|
+
- Parameters: None
|
|
584
|
+
- Read-only: **true**
|
|
392
585
|
|
|
393
586
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
394
587
|
|
|
395
|
-
- **
|
|
396
|
-
- Title:
|
|
397
|
-
- Description:
|
|
588
|
+
- **browser_resize**
|
|
589
|
+
- Title: Resize browser window
|
|
590
|
+
- Description: Resize the browser window
|
|
398
591
|
- Parameters:
|
|
399
|
-
- `
|
|
400
|
-
- `
|
|
401
|
-
- Read-only: **
|
|
592
|
+
- `width` (number): Width of the browser window
|
|
593
|
+
- `height` (number): Height of the browser window
|
|
594
|
+
- Read-only: **true**
|
|
595
|
+
|
|
596
|
+
</details>
|
|
402
597
|
|
|
403
|
-
|
|
598
|
+
<details>
|
|
599
|
+
<summary><b>Tabs</b></summary>
|
|
404
600
|
|
|
405
601
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
406
602
|
|
|
@@ -437,108 +633,107 @@ X Y coordinate space, based on the provided screenshot.
|
|
|
437
633
|
- `index` (number, optional): The index of the tab to close. Closes current tab if not provided.
|
|
438
634
|
- Read-only: **false**
|
|
439
635
|
|
|
440
|
-
|
|
636
|
+
</details>
|
|
637
|
+
|
|
638
|
+
<details>
|
|
639
|
+
<summary><b>Testing</b></summary>
|
|
441
640
|
|
|
442
641
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
443
642
|
|
|
444
|
-
- **
|
|
445
|
-
- Title:
|
|
446
|
-
- Description:
|
|
643
|
+
- **browser_generate_playwright_test**
|
|
644
|
+
- Title: Generate a Playwright test
|
|
645
|
+
- Description: Generate a Playwright test for given scenario
|
|
447
646
|
- Parameters:
|
|
448
|
-
- `
|
|
449
|
-
|
|
647
|
+
- `name` (string): The name of the test
|
|
648
|
+
- `description` (string): The description of the test
|
|
649
|
+
- `steps` (array): The steps of the test
|
|
650
|
+
- Read-only: **true**
|
|
450
651
|
|
|
451
|
-
|
|
652
|
+
</details>
|
|
452
653
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
- Description: Go back to the previous page
|
|
456
|
-
- Parameters: None
|
|
457
|
-
- Read-only: **true**
|
|
654
|
+
<details>
|
|
655
|
+
<summary><b>Vision mode</b></summary>
|
|
458
656
|
|
|
459
657
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
460
658
|
|
|
461
|
-
- **
|
|
462
|
-
- Title:
|
|
463
|
-
- Description:
|
|
659
|
+
- **browser_screen_capture**
|
|
660
|
+
- Title: Take a screenshot
|
|
661
|
+
- Description: Take a screenshot of the current page
|
|
464
662
|
- Parameters: None
|
|
465
663
|
- Read-only: **true**
|
|
466
664
|
|
|
467
|
-
### Keyboard
|
|
468
|
-
|
|
469
665
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
470
666
|
|
|
471
|
-
- **
|
|
472
|
-
- Title:
|
|
473
|
-
- Description:
|
|
667
|
+
- **browser_screen_move_mouse**
|
|
668
|
+
- Title: Move mouse
|
|
669
|
+
- Description: Move mouse to a given position
|
|
474
670
|
- Parameters:
|
|
475
|
-
- `
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
### Console
|
|
479
|
-
|
|
480
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
481
|
-
|
|
482
|
-
- **browser_console_messages**
|
|
483
|
-
- Title: Get console messages
|
|
484
|
-
- Description: Returns all console messages
|
|
485
|
-
- Parameters: None
|
|
671
|
+
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
672
|
+
- `x` (number): X coordinate
|
|
673
|
+
- `y` (number): Y coordinate
|
|
486
674
|
- Read-only: **true**
|
|
487
675
|
|
|
488
|
-
### Files and Media
|
|
489
|
-
|
|
490
676
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
491
677
|
|
|
492
|
-
- **
|
|
493
|
-
- Title:
|
|
494
|
-
- Description:
|
|
678
|
+
- **browser_screen_click**
|
|
679
|
+
- Title: Click
|
|
680
|
+
- Description: Click left mouse button
|
|
495
681
|
- Parameters:
|
|
496
|
-
- `
|
|
682
|
+
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
683
|
+
- `x` (number): X coordinate
|
|
684
|
+
- `y` (number): Y coordinate
|
|
497
685
|
- Read-only: **false**
|
|
498
686
|
|
|
499
687
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
500
688
|
|
|
501
|
-
- **
|
|
502
|
-
- Title:
|
|
503
|
-
- Description:
|
|
504
|
-
- Parameters:
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
689
|
+
- **browser_screen_drag**
|
|
690
|
+
- Title: Drag mouse
|
|
691
|
+
- Description: Drag left mouse button
|
|
692
|
+
- Parameters:
|
|
693
|
+
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
694
|
+
- `startX` (number): Start X coordinate
|
|
695
|
+
- `startY` (number): Start Y coordinate
|
|
696
|
+
- `endX` (number): End X coordinate
|
|
697
|
+
- `endY` (number): End Y coordinate
|
|
698
|
+
- Read-only: **false**
|
|
508
699
|
|
|
509
700
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
510
701
|
|
|
511
|
-
- **
|
|
512
|
-
- Title:
|
|
513
|
-
- Description:
|
|
514
|
-
- Parameters:
|
|
515
|
-
|
|
702
|
+
- **browser_screen_type**
|
|
703
|
+
- Title: Type text
|
|
704
|
+
- Description: Type text
|
|
705
|
+
- Parameters:
|
|
706
|
+
- `text` (string): Text to type into the element
|
|
707
|
+
- `submit` (boolean, optional): Whether to submit entered text (press Enter after)
|
|
708
|
+
- Read-only: **false**
|
|
516
709
|
|
|
517
710
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
518
711
|
|
|
519
|
-
- **
|
|
520
|
-
- Title:
|
|
521
|
-
- Description:
|
|
712
|
+
- **browser_press_key**
|
|
713
|
+
- Title: Press a key
|
|
714
|
+
- Description: Press a key on the keyboard
|
|
522
715
|
- Parameters:
|
|
523
|
-
- `
|
|
524
|
-
- Read-only: **
|
|
716
|
+
- `key` (string): Name of the key to press or a character to generate, such as `ArrowLeft` or `a`
|
|
717
|
+
- Read-only: **false**
|
|
525
718
|
|
|
526
719
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
527
720
|
|
|
528
|
-
- **
|
|
529
|
-
- Title:
|
|
530
|
-
- Description:
|
|
721
|
+
- **browser_wait_for**
|
|
722
|
+
- Title: Wait for
|
|
723
|
+
- Description: Wait for text to appear or disappear or a specified time to pass
|
|
531
724
|
- Parameters:
|
|
532
|
-
- `
|
|
533
|
-
- `
|
|
725
|
+
- `time` (number, optional): The time to wait in seconds
|
|
726
|
+
- `text` (string, optional): The text to wait for
|
|
727
|
+
- `textGone` (string, optional): The text to wait for to disappear
|
|
534
728
|
- Read-only: **true**
|
|
535
729
|
|
|
536
730
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
537
731
|
|
|
538
|
-
- **
|
|
539
|
-
- Title:
|
|
540
|
-
- Description:
|
|
541
|
-
- Parameters:
|
|
732
|
+
- **browser_file_upload**
|
|
733
|
+
- Title: Upload files
|
|
734
|
+
- Description: Upload one or multiple files
|
|
735
|
+
- Parameters:
|
|
736
|
+
- `paths` (array): The absolute paths to the files to upload. Can be a single file or multiple files.
|
|
542
737
|
- Read-only: **false**
|
|
543
738
|
|
|
544
739
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -551,25 +746,7 @@ X Y coordinate space, based on the provided screenshot.
|
|
|
551
746
|
- `promptText` (string, optional): The text of the prompt in case of a prompt dialog.
|
|
552
747
|
- Read-only: **false**
|
|
553
748
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
- **browser_network_requests**
|
|
557
|
-
- Title: List network requests
|
|
558
|
-
- Description: Returns all network requests since loading the page
|
|
559
|
-
- Parameters: None
|
|
560
|
-
- Read-only: **true**
|
|
561
|
-
|
|
562
|
-
### Testing
|
|
749
|
+
</details>
|
|
563
750
|
|
|
564
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
565
|
-
|
|
566
|
-
- **browser_generate_playwright_test**
|
|
567
|
-
- Title: Generate a Playwright test
|
|
568
|
-
- Description: Generate a Playwright test for given scenario
|
|
569
|
-
- Parameters:
|
|
570
|
-
- `name` (string): The name of the test
|
|
571
|
-
- `description` (string): The description of the test
|
|
572
|
-
- `steps` (array): The steps of the test
|
|
573
|
-
- Read-only: **true**
|
|
574
751
|
|
|
575
|
-
<!--- End of generated section -->
|
|
752
|
+
<!--- End of tools generated section -->
|