You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+245-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
## Cloudflare Playwright MCP
2
2
3
+
[](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/playwright-mcp/tree/main/cloudflare/example)
4
+
3
5
### Overview
4
6
5
7
This project leverages Playwright for automated browser testing and integrates with Cloudflare Workers, [Browser Rendering](https://developers.cloudflare.com/browser-rendering/) and [`@cloudflare/playwright`](https://github.com/cloudflare/playwright) for deployment.
@@ -13,9 +15,16 @@ Follow these steps to set up and deploy the project:
After installation, the Playwright MCP server will be available for use with your GitHub Copilot agent in VS Code.
116
+
117
+
### Tool Modes
118
+
119
+
The tools are available in two modes:
120
+
121
+
1.**Snapshot Mode** (default): Uses accessibility snapshots for better performance and reliability
122
+
2.**Vision Mode**: Uses screenshots for visual-based interactions
123
+
124
+
Vision Mode works best with the computer use models that are able to interact with elements using
125
+
X Y coordinate space, based on the provided screenshot.
126
+
127
+
<!--- Generated by update-readme.js -->
128
+
129
+
### Snapshot-based Interactions
130
+
131
+
<!-- NOTE: This has been generated via update-readme.js -->
132
+
133
+
-**browser_snapshot**
134
+
- Description: Capture accessibility snapshot of the current page, this is better than screenshot
135
+
- Parameters: None
136
+
137
+
<!-- NOTE: This has been generated via update-readme.js -->
138
+
139
+
-**browser_click**
140
+
- Description: Perform click on a web page
141
+
- Parameters:
142
+
-`element` (string): Human-readable element description used to obtain permission to interact with the element
143
+
-`ref` (string): Exact target element reference from the page snapshot
144
+
145
+
<!-- NOTE: This has been generated via update-readme.js -->
146
+
147
+
-**browser_drag**
148
+
- Description: Perform drag and drop between two elements
149
+
- Parameters:
150
+
-`startElement` (string): Human-readable source element description used to obtain the permission to interact with the element
151
+
-`startRef` (string): Exact source element reference from the page snapshot
152
+
-`endElement` (string): Human-readable target element description used to obtain the permission to interact with the element
153
+
-`endRef` (string): Exact target element reference from the page snapshot
154
+
155
+
<!-- NOTE: This has been generated via update-readme.js -->
156
+
157
+
-**browser_hover**
158
+
- Description: Hover over element on page
159
+
- Parameters:
160
+
-`element` (string): Human-readable element description used to obtain permission to interact with the element
161
+
-`ref` (string): Exact target element reference from the page snapshot
162
+
163
+
<!-- NOTE: This has been generated via update-readme.js -->
164
+
165
+
-**browser_type**
166
+
- Description: Type text into editable element
167
+
- Parameters:
168
+
-`element` (string): Human-readable element description used to obtain permission to interact with the element
169
+
-`ref` (string): Exact target element reference from the page snapshot
170
+
-`text` (string): Text to type into the element
171
+
-`submit` (boolean, optional): Whether to submit entered text (press Enter after)
172
+
-`slowly` (boolean, optional): Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.
173
+
174
+
<!-- NOTE: This has been generated via update-readme.js -->
175
+
176
+
-**browser_select_option**
177
+
- Description: Select an option in a dropdown
178
+
- Parameters:
179
+
-`element` (string): Human-readable element description used to obtain permission to interact with the element
180
+
-`ref` (string): Exact target element reference from the page snapshot
181
+
-`values` (array): Array of values to select in the dropdown. This can be a single value or multiple values.
182
+
183
+
<!-- NOTE: This has been generated via update-readme.js -->
184
+
185
+
-**browser_take_screenshot**
186
+
- Description: Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.
187
+
- Parameters:
188
+
-`raw` (boolean, optional): Whether to return without compression (in PNG format). Default is false, which returns a JPEG image.
189
+
-`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.
190
+
-`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.
191
+
192
+
### Vision-based Interactions
193
+
194
+
<!-- NOTE: This has been generated via update-readme.js -->
195
+
196
+
-**browser_screen_capture**
197
+
- Description: Take a screenshot of the current page
198
+
- Parameters: None
199
+
200
+
<!-- NOTE: This has been generated via update-readme.js -->
201
+
202
+
-**browser_screen_move_mouse**
203
+
- Description: Move mouse to a given position
204
+
- Parameters:
205
+
-`element` (string): Human-readable element description used to obtain permission to interact with the element
206
+
-`x` (number): X coordinate
207
+
-`y` (number): Y coordinate
208
+
209
+
<!-- NOTE: This has been generated via update-readme.js -->
210
+
211
+
-**browser_screen_click**
212
+
- Description: Click left mouse button
213
+
- Parameters:
214
+
-`element` (string): Human-readable element description used to obtain permission to interact with the element
215
+
-`x` (number): X coordinate
216
+
-`y` (number): Y coordinate
217
+
218
+
<!-- NOTE: This has been generated via update-readme.js -->
219
+
220
+
-**browser_screen_drag**
221
+
- Description: Drag left mouse button
222
+
- Parameters:
223
+
-`element` (string): Human-readable element description used to obtain permission to interact with the element
224
+
-`startX` (number): Start X coordinate
225
+
-`startY` (number): Start Y coordinate
226
+
-`endX` (number): End X coordinate
227
+
-`endY` (number): End Y coordinate
228
+
229
+
<!-- NOTE: This has been generated via update-readme.js -->
230
+
231
+
-**browser_screen_type**
232
+
- Description: Type text
233
+
- Parameters:
234
+
-`text` (string): Text to type into the element
235
+
-`submit` (boolean, optional): Whether to submit entered text (press Enter after)
236
+
237
+
### Tab Management
238
+
239
+
<!-- NOTE: This has been generated via update-readme.js -->
240
+
241
+
-**browser_tab_list**
242
+
- Description: List browser tabs
243
+
- Parameters: None
244
+
245
+
<!-- NOTE: This has been generated via update-readme.js -->
246
+
247
+
-**browser_tab_new**
248
+
- Description: Open a new tab
249
+
- Parameters:
250
+
-`url` (string, optional): The URL to navigate to in the new tab. If not provided, the new tab will be blank.
251
+
252
+
<!-- NOTE: This has been generated via update-readme.js -->
253
+
254
+
-**browser_tab_select**
255
+
- Description: Select a tab by index
256
+
- Parameters:
257
+
-`index` (number): The index of the tab to select
258
+
259
+
<!-- NOTE: This has been generated via update-readme.js -->
260
+
261
+
-**browser_tab_close**
262
+
- Description: Close a tab
263
+
- Parameters:
264
+
-`index` (number, optional): The index of the tab to close. Closes current tab if not provided.
265
+
266
+
### Navigation
267
+
268
+
<!-- NOTE: This has been generated via update-readme.js -->
269
+
270
+
-**browser_navigate**
271
+
- Description: Navigate to a URL
272
+
- Parameters:
273
+
-`url` (string): The URL to navigate to
274
+
275
+
<!-- NOTE: This has been generated via update-readme.js -->
276
+
277
+
-**browser_navigate_back**
278
+
- Description: Go back to the previous page
279
+
- Parameters: None
280
+
281
+
<!-- NOTE: This has been generated via update-readme.js -->
282
+
283
+
-**browser_navigate_forward**
284
+
- Description: Go forward to the next page
285
+
- Parameters: None
286
+
287
+
### Keyboard
288
+
289
+
<!-- NOTE: This has been generated via update-readme.js -->
290
+
291
+
-**browser_press_key**
292
+
- Description: Press a key on the keyboard
293
+
- Parameters:
294
+
-`key` (string): Name of the key to press or a character to generate, such as `ArrowLeft` or `a`
295
+
296
+
### Console
297
+
298
+
<!-- NOTE: This has been generated via update-readme.js -->
299
+
300
+
-**browser_console_messages**
301
+
- Description: Returns all console messages
302
+
- Parameters: None
303
+
304
+
### Files and Media
305
+
306
+
<!-- NOTE: This has been generated via update-readme.js -->
307
+
308
+
-**browser_file_upload**
309
+
- Description: Upload one or multiple files
310
+
- Parameters:
311
+
-`paths` (array): The absolute paths to the files to upload. Can be a single file or multiple files.
312
+
313
+
<!-- NOTE: This has been generated via update-readme.js -->
314
+
315
+
-**browser_pdf_save**
316
+
- Description: Save page as PDF
317
+
- Parameters: None
318
+
319
+
### Utilities
320
+
321
+
<!-- NOTE: This has been generated via update-readme.js -->
322
+
323
+
-**browser_close**
324
+
- Description: Close the page
325
+
- Parameters: None
326
+
327
+
<!-- NOTE: This has been generated via update-readme.js -->
328
+
329
+
-**browser_wait**
330
+
- Description: Wait for a specified time in seconds
331
+
- Parameters:
332
+
-`time` (number): The time to wait in seconds
333
+
334
+
<!-- NOTE: This has been generated via update-readme.js -->
335
+
336
+
-**browser_resize**
337
+
- Description: Resize the browser window
338
+
- Parameters:
339
+
-`width` (number): Width of the browser window
340
+
-`height` (number): Height of the browser window
341
+
342
+
<!-- NOTE: This has been generated via update-readme.js -->
343
+
344
+
-**browser_handle_dialog**
345
+
- Description: Handle a dialog
346
+
- Parameters:
347
+
-`accept` (boolean): Whether to accept the dialog.
348
+
-`promptText` (string, optional): The text of the prompt in case of a prompt dialog.
0 commit comments