swipe
Simulates real touch gestures across a mobile browser tab to close drawers, move carousels, pull to refresh, or scroll by starting on an element or coordinates and dragging a set distance.
Instructions
Swipe a finger across the session's active tab with real CDP touch input (touchstart, touchmove, touchend, and the matching pointer events), e.g. to close a drawer, move a carousel, pull to refresh or scroll the way a phone does. Start on an element (selector, or plain words as for click), at x,y, or by default the middle of the screen; end distance pixels away in direction (default 60% of the screen along that axis) or exactly at toX,toY. durationMs sets the speed (default 300): short and slow drags a drawer partway, to check it snaps back. Use it on mobile sessions (open_browser_session with useMobileUA); pages that listen only for mouse events won't react. Returns where the swipe started and ended.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>"
},
"name": "swipe"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Start, horizontal viewport coordinate, used with `y` when no selector is given. | |
| y | No | Start, vertical viewport coordinate, used with `x` when no selector is given. | |
| toX | No | End, horizontal viewport coordinate, with `toY`; overrides `direction`. | |
| toY | No | End, vertical viewport coordinate, with `toX`; overrides `direction`. | |
| timeout | No | Milliseconds to wait for `selector` to appear. Default 5000. | |
| distance | No | How far to move in `direction`, in CSS pixels. Default 60% of the screen's width (left, right) or height (up, down). | |
| selector | No | Element to start on (its center): a CSS selector, or plain words as for click. | |
| direction | No | Which way the finger moves. Needed unless `toX` and `toY` are given. | |
| sessionId | Yes | The id returned by open_browser_session. Errors if no open session has it. | |
| durationMs | No | How long the finger takes to move, in milliseconds. Default 300. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hit | No | What was at the clicked or tapped point. | |
| url | Yes | The page's URL after the action. | |
| title | Yes | The page's title after the action. | |
| dialog | No | An open dialog's text, if one is showing. | |
| changed | No | A field `type` filled that the page changed once focus left it (a date that reformats or reverts on blur), with both texts. | |
| focused | Yes | The element with keyboard focus, or "nothing". | |
| options | No | The options of a dropdown or list open after the action (the one the focused field controls, else any showing), up to 50: pick one with select_option or click. | |
| answered | No | The page's own dialogs (alert, confirm, prompt, "Leave site?") answered since the last action, each accepted. | |
| rejected | No | Fields the page rejected during the action, each with its message: the browser's own form check (a required field left empty), or the page marking them invalid. The form wasn't sent while any remain. | |
| navigated | Yes | Whether the URL changed. | |
| focusTrail | No | With press_key's `repeat`: the focused element after each press. |