@wdio/mcp 2.3.1 → 2.4.1
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 +35 -0
- package/lib/server.js +510 -19
- package/lib/server.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,6 +83,8 @@ appium
|
|
|
83
83
|
- **Page Analysis**: Get visible elements, accessibility trees, take screenshots
|
|
84
84
|
- **Cookie Management**: Get, set, and delete cookies
|
|
85
85
|
- **Scrolling**: Smooth scrolling with configurable distances
|
|
86
|
+
- **Attach to running Chrome**: Connect to an existing Chrome window via `--remote-debugging-port` — ideal for testing authenticated or pre-configured sessions
|
|
87
|
+
- **Device emulation**: Apply mobile/tablet presets (iPhone 15, Pixel 7, etc.) to simulate responsive layouts without a physical device
|
|
86
88
|
|
|
87
89
|
### Mobile App Automation (iOS/Android)
|
|
88
90
|
|
|
@@ -102,6 +104,8 @@ appium
|
|
|
102
104
|
| `start_browser` | Start a browser session (Chrome, Firefox, Edge, Safari; headless/headed, custom dimensions) |
|
|
103
105
|
| `start_app_session` | Start an iOS or Android app session via Appium (supports state preservation via noReset) |
|
|
104
106
|
| `close_session` | Close or detach from the current browser or app session (supports detach mode) |
|
|
107
|
+
| `attach_browser` | Attach to a running Chrome instance via `--remote-debugging-port` (CDP) |
|
|
108
|
+
| `emulate_device` | Emulate a mobile/tablet device preset (viewport, DPR, UA, touch); requires BiDi session |
|
|
105
109
|
|
|
106
110
|
### Navigation & Page Interaction (Web & Mobile)
|
|
107
111
|
|
|
@@ -231,6 +235,37 @@ start_browser({
|
|
|
231
235
|
})
|
|
232
236
|
```
|
|
233
237
|
|
|
238
|
+
**Attach to a running Chrome instance:**
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
// First, launch Chrome with remote debugging enabled:
|
|
242
|
+
//
|
|
243
|
+
// macOS (must quit Chrome first — open -a ignores args if Chrome is already running):
|
|
244
|
+
// pkill -x "Google Chrome" && sleep 1
|
|
245
|
+
// /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
|
|
246
|
+
// --remote-debugging-port=9222 \
|
|
247
|
+
// --user-data-dir=/tmp/chrome-debug &
|
|
248
|
+
//
|
|
249
|
+
// Linux:
|
|
250
|
+
// google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug &
|
|
251
|
+
//
|
|
252
|
+
// Verify it's ready: curl http://localhost:9222/json/version
|
|
253
|
+
attach_browser()
|
|
254
|
+
attach_browser({port: 9333})
|
|
255
|
+
attach_browser({port: 9222, navigationUrl: 'https://app.example.com'})
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Device emulation (requires BiDi session):**
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
// Device emulation (requires BiDi session)
|
|
262
|
+
start_browser({capabilities: {webSocketUrl: true}})
|
|
263
|
+
emulate_device() // list available presets
|
|
264
|
+
emulate_device({device: 'iPhone 15'}) // activate emulation
|
|
265
|
+
emulate_device({device: 'Pixel 7'}) // switch device
|
|
266
|
+
emulate_device({device: 'reset'}) // restore desktop defaults
|
|
267
|
+
```
|
|
268
|
+
|
|
234
269
|
### Mobile App Automation
|
|
235
270
|
|
|
236
271
|
**Testing an iOS app on simulator:**
|