swipe
Simulate real touch swipes on a mobile browser session to close drawers, move carousels, scroll, or trigger pull to refresh. Define start point, direction, distance, and speed.
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.
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. |