@wdio/mcp 3.2.4 → 3.3.0
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 +165 -102
- package/lib/server.js +325 -89
- package/lib/server.js.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# WebDriverIO MCP Server
|
|
2
2
|
|
|
3
3
|
A Model Context Protocol (MCP) server that enables AI assistants to interact with web browsers and mobile applications
|
|
4
|
-
using WebDriverIO. Automate Chrome, Firefox, Edge, and Safari browsers plus iOS and Android apps—all through a unified
|
|
4
|
+
using WebDriverIO. Automate Chrome, Firefox, Edge, and Safari browsers plus iOS and Android apps—all through a unified
|
|
5
|
+
interface.
|
|
5
6
|
|
|
6
7
|
## Installation
|
|
7
8
|
|
|
@@ -16,7 +17,10 @@ Add the following configuration to your MCP client settings:
|
|
|
16
17
|
"mcpServers": {
|
|
17
18
|
"wdio-mcp": {
|
|
18
19
|
"command": "npx",
|
|
19
|
-
"args": [
|
|
20
|
+
"args": [
|
|
21
|
+
"-y",
|
|
22
|
+
"@wdio/mcp@latest"
|
|
23
|
+
]
|
|
20
24
|
}
|
|
21
25
|
}
|
|
22
26
|
}
|
|
@@ -29,18 +33,23 @@ Add the following configuration to your MCP client settings:
|
|
|
29
33
|
<details>
|
|
30
34
|
<summary>Claude Desktop</summary>
|
|
31
35
|
|
|
32
|
-
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS),
|
|
36
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS),
|
|
37
|
+
`%APPDATA%\Claude\claude_desktop_config.json` (Windows), or `~/.config/Claude/claude_desktop_config.json` (Linux):
|
|
33
38
|
|
|
34
39
|
```json
|
|
35
40
|
{
|
|
36
41
|
"mcpServers": {
|
|
37
42
|
"wdio-mcp": {
|
|
38
43
|
"command": "npx",
|
|
39
|
-
"args": [
|
|
44
|
+
"args": [
|
|
45
|
+
"-y",
|
|
46
|
+
"@wdio/mcp@latest"
|
|
47
|
+
]
|
|
40
48
|
}
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
51
|
```
|
|
52
|
+
|
|
44
53
|
</details>
|
|
45
54
|
|
|
46
55
|
<details>
|
|
@@ -49,6 +58,7 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS),
|
|
|
49
58
|
```bash
|
|
50
59
|
claude mcp add wdio-mcp -- npx -y @wdio/mcp@latest
|
|
51
60
|
```
|
|
61
|
+
|
|
52
62
|
</details>
|
|
53
63
|
|
|
54
64
|
<details>
|
|
@@ -62,11 +72,15 @@ Add to your VS Code `settings.json` or `cline_mcp_settings.json` file:
|
|
|
62
72
|
"wdio-mcp": {
|
|
63
73
|
"type": "stdio",
|
|
64
74
|
"command": "npx",
|
|
65
|
-
"args": [
|
|
75
|
+
"args": [
|
|
76
|
+
"-y",
|
|
77
|
+
"@wdio/mcp@latest"
|
|
78
|
+
]
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
81
|
}
|
|
69
82
|
```
|
|
83
|
+
|
|
70
84
|
</details>
|
|
71
85
|
|
|
72
86
|
<details>
|
|
@@ -79,11 +93,15 @@ Go to `Cursor Settings` → `MCP` → `Add new MCP Server`, or create `.cursor/m
|
|
|
79
93
|
"mcpServers": {
|
|
80
94
|
"wdio-mcp": {
|
|
81
95
|
"command": "npx",
|
|
82
|
-
"args": [
|
|
96
|
+
"args": [
|
|
97
|
+
"-y",
|
|
98
|
+
"@wdio/mcp@latest"
|
|
99
|
+
]
|
|
83
100
|
}
|
|
84
101
|
}
|
|
85
102
|
}
|
|
86
103
|
```
|
|
104
|
+
|
|
87
105
|
</details>
|
|
88
106
|
|
|
89
107
|
<details>
|
|
@@ -102,6 +120,7 @@ Or edit `~/.codex/config.toml`:
|
|
|
102
120
|
command = "npx"
|
|
103
121
|
args = ["@wdio/mcp@latest"]
|
|
104
122
|
```
|
|
123
|
+
|
|
105
124
|
</details>
|
|
106
125
|
|
|
107
126
|
<details>
|
|
@@ -120,10 +139,11 @@ extensions:
|
|
|
120
139
|
wdio-mcp:
|
|
121
140
|
name: WebDriverIO MCP
|
|
122
141
|
cmd: npx
|
|
123
|
-
args: [-y, "@wdio/mcp@latest"]
|
|
142
|
+
args: [ -y, "@wdio/mcp@latest" ]
|
|
124
143
|
enabled: true
|
|
125
144
|
type: stdio
|
|
126
145
|
```
|
|
146
|
+
|
|
127
147
|
</details>
|
|
128
148
|
|
|
129
149
|
<details>
|
|
@@ -136,11 +156,15 @@ Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
|
136
156
|
"mcpServers": {
|
|
137
157
|
"wdio-mcp": {
|
|
138
158
|
"command": "npx",
|
|
139
|
-
"args": [
|
|
159
|
+
"args": [
|
|
160
|
+
"-y",
|
|
161
|
+
"@wdio/mcp@latest"
|
|
162
|
+
]
|
|
140
163
|
}
|
|
141
164
|
}
|
|
142
165
|
}
|
|
143
166
|
```
|
|
167
|
+
|
|
144
168
|
</details>
|
|
145
169
|
|
|
146
170
|
<details>
|
|
@@ -154,11 +178,15 @@ Edit Zed settings (`~/.config/zed/settings.json`):
|
|
|
154
178
|
"wdio-mcp": {
|
|
155
179
|
"source": "custom",
|
|
156
180
|
"command": "npx",
|
|
157
|
-
"args": [
|
|
181
|
+
"args": [
|
|
182
|
+
"-y",
|
|
183
|
+
"@wdio/mcp@latest"
|
|
184
|
+
]
|
|
158
185
|
}
|
|
159
186
|
}
|
|
160
187
|
}
|
|
161
188
|
```
|
|
189
|
+
|
|
162
190
|
</details>
|
|
163
191
|
|
|
164
192
|
<details>
|
|
@@ -167,6 +195,7 @@ Edit Zed settings (`~/.config/zed/settings.json`):
|
|
|
167
195
|
```bash
|
|
168
196
|
code --add-mcp '{"name":"wdio-mcp","command":"npx","args":["-y","@wdio/mcp@latest"]}'
|
|
169
197
|
```
|
|
198
|
+
|
|
170
199
|
</details>
|
|
171
200
|
|
|
172
201
|
----
|
|
@@ -194,6 +223,24 @@ Then use `wdio-mcp` as the command:
|
|
|
194
223
|
|
|
195
224
|
📖 **Need help?** Follow the [MCP install guide](https://modelcontextprotocol.io/quickstart/user).
|
|
196
225
|
|
|
226
|
+
### HTTP Transport (for non-subprocess clients)
|
|
227
|
+
|
|
228
|
+
By default the server uses **stdio** (subprocess) transport. For clients that cannot launch subprocesses (e.g.
|
|
229
|
+
llama.cpp, OpenAI Codex secure mode), enable HTTP transport:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
npx @wdio/mcp --http --port 3000
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
| Flag | Default | Description |
|
|
236
|
+
|--------------------|------------------------------------|---------------------------------------------------------|
|
|
237
|
+
| `--http` | — | Enable HTTP transport mode |
|
|
238
|
+
| `--port` | `3000` | Port to listen on |
|
|
239
|
+
| `--allowedHosts` | `localhost,127.0.0.1,::1` | Allowed `Host` header values (DNS rebinding protection) |
|
|
240
|
+
| `--allowedOrigins` | _(none — browser clients blocked)_ | Allowed `Origin` values for CORS. Use `*` to allow all. |
|
|
241
|
+
|
|
242
|
+
Then point your MCP client at `http://localhost:3000/mcp`.
|
|
243
|
+
|
|
197
244
|
### Prerequisites For Mobile App Automation
|
|
198
245
|
|
|
199
246
|
- **Appium Server**: Install globally with `npm install -g appium`
|
|
@@ -218,7 +265,8 @@ appium
|
|
|
218
265
|
|
|
219
266
|
## BrowserStack
|
|
220
267
|
|
|
221
|
-
Run browser and mobile app tests on [BrowserStack](https://www.browserstack.com/) real devices and browsers without any
|
|
268
|
+
Run browser and mobile app tests on [BrowserStack](https://www.browserstack.com/) real devices and browsers without any
|
|
269
|
+
local setup.
|
|
222
270
|
|
|
223
271
|
### Prerequisites
|
|
224
272
|
|
|
@@ -236,7 +284,10 @@ Or add them to your MCP client config:
|
|
|
236
284
|
"mcpServers": {
|
|
237
285
|
"wdio-mcp": {
|
|
238
286
|
"command": "npx",
|
|
239
|
-
"args": [
|
|
287
|
+
"args": [
|
|
288
|
+
"-y",
|
|
289
|
+
"@wdio/mcp@latest"
|
|
290
|
+
],
|
|
240
291
|
"env": {
|
|
241
292
|
"BROWSERSTACK_USERNAME": "your_username",
|
|
242
293
|
"BROWSERSTACK_ACCESS_KEY": "your_access_key"
|
|
@@ -252,17 +303,17 @@ Run a browser on a specific OS/version combination:
|
|
|
252
303
|
|
|
253
304
|
```javascript
|
|
254
305
|
start_session({
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
306
|
+
provider: 'browserstack',
|
|
307
|
+
platform: 'browser',
|
|
308
|
+
browser: 'chrome', // chrome | firefox | edge | safari
|
|
309
|
+
browserVersion: 'latest', // default: latest
|
|
310
|
+
os: 'Windows', // e.g. "Windows", "OS X"
|
|
311
|
+
osVersion: '11', // e.g. "11", "Sequoia"
|
|
312
|
+
reporting: {
|
|
313
|
+
project: 'My Project',
|
|
314
|
+
build: 'v1.2.0',
|
|
315
|
+
session: 'Login flow'
|
|
316
|
+
}
|
|
266
317
|
})
|
|
267
318
|
```
|
|
268
319
|
|
|
@@ -272,20 +323,20 @@ Test on BrowserStack real devices. First upload your app (or use an existing `bs
|
|
|
272
323
|
|
|
273
324
|
```javascript
|
|
274
325
|
// Upload a local .apk or .ipa (returns a bs:// URL)
|
|
275
|
-
upload_app({
|
|
326
|
+
upload_app({path: '/path/to/app.apk'})
|
|
276
327
|
|
|
277
328
|
// Start a session with the returned URL
|
|
278
329
|
start_session({
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
330
|
+
provider: 'browserstack',
|
|
331
|
+
platform: 'android', // android | ios
|
|
332
|
+
app: 'bs://abc123...', // bs:// URL or custom_id from upload
|
|
333
|
+
deviceName: 'Samsung Galaxy S23',
|
|
334
|
+
platformVersion: '13.0',
|
|
335
|
+
reporting: {
|
|
336
|
+
project: 'My Project',
|
|
337
|
+
build: 'v1.2.0',
|
|
338
|
+
session: 'Checkout flow'
|
|
339
|
+
}
|
|
289
340
|
})
|
|
290
341
|
```
|
|
291
342
|
|
|
@@ -293,20 +344,21 @@ Use `list_apps` to see previously uploaded apps:
|
|
|
293
344
|
|
|
294
345
|
```javascript
|
|
295
346
|
list_apps() // own uploads, sorted by date
|
|
296
|
-
list_apps({
|
|
297
|
-
list_apps({
|
|
347
|
+
list_apps({sortBy: 'app_name'})
|
|
348
|
+
list_apps({organizationWide: true}) // all uploads in your org
|
|
298
349
|
```
|
|
299
350
|
|
|
300
351
|
### BrowserStack Local
|
|
301
352
|
|
|
302
|
-
To test against URLs that are only accessible on your local machine or internal network, enable the BrowserStack Local
|
|
353
|
+
To test against URLs that are only accessible on your local machine or internal network, enable the BrowserStack Local
|
|
354
|
+
tunnel:
|
|
303
355
|
|
|
304
356
|
```javascript
|
|
305
357
|
start_session({
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
358
|
+
provider: 'browserstack',
|
|
359
|
+
platform: 'browser',
|
|
360
|
+
browser: 'chrome',
|
|
361
|
+
browserstackLocal: true // starts tunnel automatically
|
|
310
362
|
})
|
|
311
363
|
```
|
|
312
364
|
|
|
@@ -314,18 +366,18 @@ start_session({
|
|
|
314
366
|
|
|
315
367
|
All session types support `reporting` labels that appear in the BrowserStack Automate dashboard:
|
|
316
368
|
|
|
317
|
-
| Field
|
|
318
|
-
|
|
319
|
-
| `reporting.project`
|
|
320
|
-
| `reporting.build`
|
|
321
|
-
| `reporting.session`
|
|
369
|
+
| Field | Description |
|
|
370
|
+
|---------------------|-----------------------------------------|
|
|
371
|
+
| `reporting.project` | Group sessions under a project name |
|
|
372
|
+
| `reporting.build` | Tag sessions with a build/version label |
|
|
373
|
+
| `reporting.session` | Name for the individual test session |
|
|
322
374
|
|
|
323
375
|
### BrowserStack Tools
|
|
324
376
|
|
|
325
|
-
| Tool
|
|
326
|
-
|
|
327
|
-
| `upload_app`
|
|
328
|
-
| `list_apps`
|
|
377
|
+
| Tool | Description |
|
|
378
|
+
|--------------|------------------------------------------------------------------------|
|
|
379
|
+
| `upload_app` | Upload a local `.apk` or `.ipa` to BrowserStack; returns a `bs://` URL |
|
|
380
|
+
| `list_apps` | List apps previously uploaded to your BrowserStack account |
|
|
329
381
|
|
|
330
382
|
## Features
|
|
331
383
|
|
|
@@ -336,8 +388,10 @@ All session types support `reporting` labels that appear in the BrowserStack Aut
|
|
|
336
388
|
- **Page Analysis**: Get visible elements, accessibility trees, take screenshots
|
|
337
389
|
- **Cookie Management**: Get, set, and delete cookies
|
|
338
390
|
- **Scrolling**: Smooth scrolling with configurable distances
|
|
339
|
-
- **Attach to running Chrome**: Connect to an existing Chrome window via `--remote-debugging-port` — ideal for testing
|
|
340
|
-
|
|
391
|
+
- **Attach to running Chrome**: Connect to an existing Chrome window via `--remote-debugging-port` — ideal for testing
|
|
392
|
+
authenticated or pre-configured sessions
|
|
393
|
+
- **Device emulation**: Apply mobile/tablet presets (iPhone 15, Pixel 7, etc.) to simulate responsive layouts without a
|
|
394
|
+
physical device
|
|
341
395
|
- **Session Recording**: All tool calls are automatically recorded and exportable as runnable WebdriverIO JS
|
|
342
396
|
|
|
343
397
|
### Mobile App Automation (iOS/Android)
|
|
@@ -353,22 +407,25 @@ All session types support `reporting` labels that appear in the BrowserStack Aut
|
|
|
353
407
|
|
|
354
408
|
### Session Management
|
|
355
409
|
|
|
356
|
-
| Tool | Description
|
|
357
|
-
|
|
410
|
+
| Tool | Description |
|
|
411
|
+
|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
358
412
|
| `start_session` | Start a browser or app session. Use `platform: 'browser'` for web, `platform: 'ios'`/`'android'` for mobile, or `attach: true` to connect to a running Chrome instance |
|
|
359
|
-
| `launch_chrome` | Launch a new Chrome instance with remote debugging enabled (for use with `start_session({ attach: true })`)
|
|
360
|
-
| `close_session` | Close or detach from the current session (supports `detach: true` to disconnect without terminating)
|
|
361
|
-
| `emulate_device` | Emulate a mobile/tablet device preset (viewport, DPR, UA, touch); requires BiDi session
|
|
413
|
+
| `launch_chrome` | Launch a new Chrome instance with remote debugging enabled (for use with `start_session({ attach: true })`) |
|
|
414
|
+
| `close_session` | Close or detach from the current session (supports `detach: true` to disconnect without terminating) |
|
|
415
|
+
| `emulate_device` | Emulate a mobile/tablet device preset (viewport, DPR, UA, touch); requires BiDi session |
|
|
362
416
|
|
|
363
417
|
### Navigation & Page Interaction (Web & Mobile)
|
|
364
418
|
|
|
365
|
-
| Tool
|
|
366
|
-
|
|
367
|
-
| `navigate`
|
|
368
|
-
| `get_elements`
|
|
369
|
-
| `
|
|
370
|
-
| `
|
|
371
|
-
| `
|
|
419
|
+
| Tool | Description |
|
|
420
|
+
|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
421
|
+
| `navigate` | Navigate to a URL |
|
|
422
|
+
| `get_elements` | Get visible, interactable elements on the page. Supports `inViewportOnly` (default: true) to filter viewport elements, and `includeContainers` (default: false) to include layout containers on mobile |
|
|
423
|
+
| `get_accessibility_tree` | Get the page accessibility tree with roles, names, and selectors. Supports filtering by role and pagination. Browser-only. |
|
|
424
|
+
| `get_screenshot` | Take a screenshot of the current page or screen (base64-encoded, auto-resized to max 2000px / 1MB) |
|
|
425
|
+
| `get_tabs` | List all open browser tabs with handle, title, URL, and active status. Browser-only. |
|
|
426
|
+
| `scroll` | Scroll in a direction (up/down) by specified pixels. Browser-only. |
|
|
427
|
+
| `execute_script` | Execute arbitrary JavaScript in the browser, or Appium mobile commands on devices |
|
|
428
|
+
| `switch_tab` | Switch to a different browser tab by handle or 0-based index. Browser-only. |
|
|
372
429
|
|
|
373
430
|
### Element Interaction (Web & Mobile)
|
|
374
431
|
|
|
@@ -379,10 +436,11 @@ All session types support `reporting` labels that appear in the BrowserStack Aut
|
|
|
379
436
|
|
|
380
437
|
### Cookie Management (Web)
|
|
381
438
|
|
|
382
|
-
| Tool | Description
|
|
383
|
-
|
|
384
|
-
| `
|
|
385
|
-
| `
|
|
439
|
+
| Tool | Description |
|
|
440
|
+
|------------------|---------------------------------------------------------------------|
|
|
441
|
+
| `get_cookies` | Get all cookies for the current session, or a single cookie by name |
|
|
442
|
+
| `set_cookie` | Set a cookie with name, value, and optional attributes |
|
|
443
|
+
| `delete_cookies` | Delete all cookies or a specific cookie |
|
|
386
444
|
|
|
387
445
|
### Mobile Gestures (iOS/Android)
|
|
388
446
|
|
|
@@ -394,38 +452,40 @@ All session types support `reporting` labels that appear in the BrowserStack Aut
|
|
|
394
452
|
|
|
395
453
|
### Context Switching (Hybrid Apps)
|
|
396
454
|
|
|
397
|
-
| Tool | Description
|
|
398
|
-
|
|
399
|
-
| `
|
|
455
|
+
| Tool | Description |
|
|
456
|
+
|------------------|-----------------------------------------------------------------------------------------|
|
|
457
|
+
| `get_contexts` | List available automation contexts (NATIVE_APP, WEBVIEW_*) and the currently active one |
|
|
458
|
+
| `switch_context` | Switch between native and webview contexts |
|
|
400
459
|
|
|
401
460
|
### Device Control (iOS/Android)
|
|
402
461
|
|
|
403
|
-
| Tool | Description
|
|
404
|
-
|
|
405
|
-
| `
|
|
406
|
-
| `
|
|
407
|
-
| `
|
|
462
|
+
| Tool | Description |
|
|
463
|
+
|-------------------|---------------------------------------------------------------------------------------------------------|
|
|
464
|
+
| `get_app_state` | Get the current lifecycle state of a mobile app (not installed / not running / background / foreground) |
|
|
465
|
+
| `rotate_device` | Rotate to portrait or landscape |
|
|
466
|
+
| `hide_keyboard` | Hide on-screen keyboard |
|
|
467
|
+
| `set_geolocation` | Set device GPS location |
|
|
408
468
|
|
|
409
469
|
### MCP Resources (read-only, no tool call needed)
|
|
410
470
|
|
|
411
|
-
| Resource
|
|
412
|
-
|
|
413
|
-
| `wdio://sessions`
|
|
414
|
-
| `wdio://session/current/steps`
|
|
415
|
-
| `wdio://session/current/code`
|
|
416
|
-
| `wdio://session/{id}/steps`
|
|
417
|
-
| `wdio://session/{id}/code`
|
|
418
|
-
| `wdio://session/current/elements`
|
|
419
|
-
| `wdio://session/current/accessibility`
|
|
420
|
-
| `wdio://session/current/screenshot`
|
|
421
|
-
| `wdio://session/current/cookies`
|
|
422
|
-
| `wdio://session/current/tabs`
|
|
423
|
-
| `wdio://session/current/contexts`
|
|
424
|
-
| `wdio://session/current/context`
|
|
425
|
-
| `wdio://session/current/app-state`
|
|
426
|
-
| `wdio://session/current/geolocation`
|
|
427
|
-
| `wdio://session/current/capabilities`
|
|
428
|
-
| `wdio://browserstack/local-binary`
|
|
471
|
+
| Resource | Description |
|
|
472
|
+
|-----------------------------------------------|----------------------------------------------------------|
|
|
473
|
+
| `wdio://sessions` | Index of all recorded sessions |
|
|
474
|
+
| `wdio://session/current/steps` | Step log for the active session |
|
|
475
|
+
| `wdio://session/current/code` | Generated runnable WebdriverIO JS for the active session |
|
|
476
|
+
| `wdio://session/{id}/steps` | Step log for any past session by ID |
|
|
477
|
+
| `wdio://session/{id}/code` | Generated JS for any past session by ID |
|
|
478
|
+
| `wdio://session/current/elements` | Interactable elements (viewport-only by default) |
|
|
479
|
+
| `wdio://session/current/accessibility` | Accessibility tree |
|
|
480
|
+
| `wdio://session/current/screenshot` | Screenshot (base64) |
|
|
481
|
+
| `wdio://session/current/cookies` | Browser cookies |
|
|
482
|
+
| `wdio://session/current/tabs` | Open browser tabs |
|
|
483
|
+
| `wdio://session/current/contexts` | Native/webview contexts (mobile) |
|
|
484
|
+
| `wdio://session/current/context` | Currently active context (mobile) |
|
|
485
|
+
| `wdio://session/current/app-state/{bundleId}` | Mobile app lifecycle state for a given bundle ID |
|
|
486
|
+
| `wdio://session/current/geolocation` | Device geolocation |
|
|
487
|
+
| `wdio://session/current/capabilities` | Resolved WebDriver capabilities for the active session |
|
|
488
|
+
| `wdio://browserstack/local-binary` | BrowserStack Local binary download URL and start command |
|
|
429
489
|
|
|
430
490
|
## Usage Examples
|
|
431
491
|
|
|
@@ -488,13 +548,13 @@ start_session({platform: 'browser', windowWidth: 1920, windowHeight: 1080})
|
|
|
488
548
|
|
|
489
549
|
// Pass custom capabilities (e.g. Chrome extensions, profile, prefs)
|
|
490
550
|
start_session({
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
551
|
+
platform: 'browser',
|
|
552
|
+
headless: false,
|
|
553
|
+
capabilities: {
|
|
554
|
+
'goog:chromeOptions': {
|
|
555
|
+
args: ['--user-data-dir=/tmp/wdio-mcp-profile', '--load-extension=/path/to/unpacked-extension']
|
|
556
|
+
}
|
|
496
557
|
}
|
|
497
|
-
}
|
|
498
558
|
})
|
|
499
559
|
```
|
|
500
560
|
|
|
@@ -522,7 +582,7 @@ start_session({attach: true, port: 9222, navigationUrl: 'https://app.example.com
|
|
|
522
582
|
|
|
523
583
|
```
|
|
524
584
|
// Device emulation (requires BiDi session)
|
|
525
|
-
|
|
585
|
+
start_session({capabilities: {webSocketUrl: true}})
|
|
526
586
|
emulate_device() // list available presets
|
|
527
587
|
emulate_device({device: 'iPhone 15'}) // activate emulation
|
|
528
588
|
emulate_device({device: 'Pixel 7'}) // switch device
|
|
@@ -723,7 +783,8 @@ This eliminates the need to manually handle permission popups during automated t
|
|
|
723
783
|
|
|
724
784
|
### Session Recording & Code Export
|
|
725
785
|
|
|
726
|
-
Every tool call is automatically recorded to a session history. You can inspect sessions and export runnable code via
|
|
786
|
+
Every tool call is automatically recorded to a session history. You can inspect sessions and export runnable code via
|
|
787
|
+
MCP resources — no extra tool calls needed:
|
|
727
788
|
|
|
728
789
|
- `wdio://sessions` — lists all recorded sessions with type, timestamps, and step count
|
|
729
790
|
- `wdio://session/current/steps` — step log for the active session
|
|
@@ -731,7 +792,9 @@ Every tool call is automatically recorded to a session history. You can inspect
|
|
|
731
792
|
- `wdio://session/{sessionId}/steps` — step log for any past session by ID
|
|
732
793
|
- `wdio://session/{sessionId}/code` — generated JS for any past session by ID
|
|
733
794
|
|
|
734
|
-
The generated script reconstructs the full session — including capabilities, navigation, clicks, and inputs — as a
|
|
795
|
+
The generated script reconstructs the full session — including capabilities, navigation, clicks, and inputs — as a
|
|
796
|
+
standalone `import { remote } from 'webdriverio'` file. For BrowserStack sessions it includes the full try/catch/finally
|
|
797
|
+
with automatic session result marking.
|
|
735
798
|
|
|
736
799
|
## Troubleshooting
|
|
737
800
|
|