Tools
The following tools are available through the WebdriverIO MCP server. These tools enable AI assistants to automate browsers and mobile applications.
Session Managementโ
start_browserโ
Launches a Chrome browser session.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
headless | boolean | No | false | Run Chrome in headless mode |
windowWidth | number | No | 1920 | Browser window width (400-3840) |
windowHeight | number | No | 1080 | Browser window height (400-2160) |
navigationUrl | string | No | - | URL to navigate to after starting the browser |
Exampleโ
Start a browser with 1920x1080 resolution and navigate to webdriver.io
Supportโ
- Desktop Browsers
start_app_sessionโ
Launches a mobile app session on iOS or Android via Appium.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
platform | string | Yes | - | Platform to automate: iOS or Android |
deviceName | string | Yes | - | Name of the device or simulator/emulator |
appPath | string | No* | - | Path to the app file (.app, .ipa, or .apk) |
platformVersion | string | No | - | OS version (e.g., 17.0, 14) |
automationName | string | No | Auto | XCUITest (iOS), UiAutomator2 or Espresso (Android) |
udid | string | No | - | Unique device identifier (required for real iOS devices) |
noReset | boolean | No | false | Preserve app state between sessions |
fullReset | boolean | No | true | Uninstall and reinstall app before session |
autoGrantPermissions | boolean | No | true | Automatically grant app permissions |
autoAcceptAlerts | boolean | No | true | Automatically accept system alerts |
autoDismissAlerts | boolean | No | false | Dismiss (instead of accept) alerts |
appWaitActivity | string | No | - | Activity to wait for on launch (Android only) |
newCommandTimeout | number | No | 60 | Seconds before session times out due to inactivity |
appiumHost | string | No | 127.0.0.1 | Appium server hostname |
appiumPort | number | No | 4723 | Appium server port |
appiumPath | string | No | / | Appium server path |
*Either appPath must be provided, or noReset: true to connect to an already-running app.
Exampleโ
Start an iOS app session on iPhone 15 simulator with my app at /path/to/app.app
Supportโ
- iOS Simulators
- iOS Real Devices
- Android Emulators
- Android Real Devices
close_sessionโ
Closes the current browser or app session.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
detach | boolean | No | false | Detach from session instead of closing (keeps browser/app running) |
Notesโ
Sessions with noReset: true or without appPath automatically detach on close to preserve state.
Supportโ
- Desktop Browsers
- Mobile Apps
Navigationโ
navigateโ
Navigates to a URL.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
url | string | Yes | The URL to navigate to |
Exampleโ
Navigate to https://webdriver.io
Supportโ
- Desktop Browsers
Element Interactionโ
click_elementโ
Clicks an element identified by a selector.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
selector | string | Yes | - | CSS selector, XPath, or mobile selector |
scrollToView | boolean | No | true | Scroll element into view before clicking |
timeout | number | No | 3000 | Max time to wait for element (ms) |
Notesโ
- Supports WebdriverIO text selectors:
button=Exact textora*=Contains text - Uses center alignment for scroll positioning
Exampleโ
Click the element with selector "#submit-button"
Supportโ
- Desktop Browsers
- Mobile Native Apps
set_valueโ
Types text into an input field.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
selector | string | Yes | - | Selector for the input element |
value | string | Yes | - | Text to type |
scrollToView | boolean | No | true | Scroll element into view before typing |
timeout | number | No | 3000 | Max time to wait for element (ms) |
Notesโ
Clears existing value before typing new text.
Exampleโ
Set the value "john@example.com" in the element with selector "#email"
Supportโ
- Desktop Browsers
- Mobile Native Apps
Page Analysisโ
get_visible_elementsโ
Gets visible and interactable elements on the current page or screen. This is the primary tool for discovering what elements are available for interaction.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
elementType | string | No | interactable | Type of elements: interactable (buttons/links/inputs), visual (images/SVGs), or all |
inViewportOnly | boolean | No | true | Only return elements visible in the viewport |
includeContainers | boolean | No | false | Include layout containers (ViewGroup, ScrollView, etc.) |
includeBounds | boolean | No | false | Include element coordinates (x, y, width, height) |
limit | number | No | 0 | Maximum elements to return (0 = unlimited) |
offset | number | No | 0 | Number of elements to skip (for pagination) |
Returnsโ
{
"total": 42,
"showing": 20,
"hasMore": true,
"elements": [...]
}
Web elements include: tagName, type, id, className, textContent, value, placeholder, href, ariaLabel, role, cssSelector, isInViewport
Mobile elements include: Multiple locator strategies (accessibility ID, resource ID, XPath, UiAutomator/predicates), element type, text, and optionally bounds
Notesโ
- Web: Uses an optimized browser script for fast element detection
- Mobile: Uses efficient XML page source parsing (2 HTTP calls vs 600+ for element queries)
- Use pagination (
limitandoffset) for large pages to reduce token usage
Exampleโ
Get all visible elements on the page with their coordinates
Supportโ
- Desktop Browsers
- Mobile Apps
get_accessibilityโ
Gets the accessibility tree of the current page with semantic information about roles, names, and states.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
limit | number | No | 100 | Maximum nodes to return (0 = unlimited) |
offset | number | No | 0 | Number of nodes to skip (for pagination) |
roles | string[] | No | All | Filter to specific roles (e.g., ["button", "link", "textbox"]) |
namedOnly | boolean | No | true | Only return nodes with a name/label |
Returnsโ
{
"total": 85,
"showing": 100,
"hasMore": false,
"nodes": [
{ "role": "button", "name": "Submit" },
{ "role": "link", "name": "Home" }
]
}
Notesโ
- Browser-only. For mobile apps, use
get_visible_elementsinstead - Useful when
get_visible_elementsdoesn't return expected elements namedOnly: truefilters out anonymous containers and reduces noise
Supportโ
- Desktop Browsers
Screenshotsโ
take_screenshotโ
Captures a screenshot of the current viewport.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
outputPath | string | No | Path to save screenshot file. If omitted, returns base64 data |
Returnsโ
Base64-encoded image data (PNG or JPEG) with size information.
Notesโ
Screenshots are automatically optimized:
- Maximum dimension: 2000px (scaled down if larger)
- Maximum file size: 1MB
- Format: PNG with max compression, or JPEG if needed to meet size limit
Supportโ
- Desktop Browsers
- Mobile Apps
Scrollingโ
scrollโ
Scrolls the page up or down by a specified number of pixels.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
direction | string | Yes | - | Scroll direction: up or down |
pixels | number | No | 500 | Number of pixels to scroll |
Notesโ
Browser-only. For mobile scrolling, use the swipe tool instead.
Supportโ
- Desktop Browsers
Cookie Managementโ
get_cookiesโ
Gets cookies from the current session.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
name | string | No | Specific cookie name to retrieve (omit for all cookies) |
Returnsโ
Cookie objects with name, value, domain, path, expiry, secure, and httpOnly properties.
Supportโ
- Desktop Browsers
set_cookieโ
Sets a cookie in the current session.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Cookie name |
value | string | Yes | - | Cookie value |
domain | string | No | Current | Cookie domain |
path | string | No | / | Cookie path |
expiry | number | No | - | Expiration as Unix timestamp (seconds) |
secure | boolean | No | - | Secure flag |
httpOnly | boolean | No | - | HttpOnly flag |
sameSite | string | No | - | SameSite attribute: strict, lax, or none |
Supportโ
- Desktop Browsers
delete_cookiesโ
Deletes cookies from the current session.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
name | string | No | Specific cookie name to delete (omit to delete all) |
Supportโ
- Desktop Browsers
Touch Gestures (Mobile)โ
tap_elementโ
Taps on an element or screen coordinates.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
selector | string | No* | Selector for the element to tap |
x | number | No* | X coordinate for tap |
y | number | No* | Y coordinate for tap |
*Either selector or both x and y are required.
Supportโ
- Mobile Apps
swipeโ
Performs a swipe gesture in the specified direction.
Parametersโ
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
direction | string | Yes | - | Swipe direction: up, down, left, right |
duration | number | No | 500 | Swipe duration in milliseconds (100-5000) |
percent | number | No | 0.5/0.95 | Percentage of screen to swipe (0-1) |
Notesโ
- Default percent: 0.5 for vertical swipes, 0.95 for horizontal swipes
- Direction indicates content movement: "swipe up" scrolls content up
Exampleโ
Swipe up to scroll down the screen
Supportโ
- Mobile Apps
drag_and_dropโ
Drags an element to another element or coordinates.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
sourceSelector | string | Yes | Source element selector to drag |
targetSelector | string | No* | Target element selector to drop onto |
x | number | No* | Target X offset (if no targetSelector) |
y | number | No* | Target Y offset (if no targetSelector) |
duration | number | No | Default |
*Either targetSelector or both x and y are required.
Supportโ
- Mobile Apps
App Lifecycle (Mobile)โ
get_app_stateโ
Gets the current state of an app.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
bundleId | string | Yes | App identifier (bundle ID for iOS, package name for Android) |
Returnsโ
App state: not installed, not running, running in background (suspended), running in background, or running in foreground.
Supportโ
- Mobile Apps
Context Switching (Hybrid Apps)โ
get_contextsโ
Lists all available contexts (native and webviews).
Parametersโ
None
Returnsโ
Array of context names (e.g., ["NATIVE_APP", "WEBVIEW_com.example.app"]).
Supportโ
- Mobile Hybrid Apps
get_current_contextโ
Gets the currently active context.
Parametersโ
None
Returnsโ
Current context name (e.g., NATIVE_APP or WEBVIEW_*).
Supportโ
- Mobile Hybrid Apps
switch_contextโ
Switches between native and webview contexts.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
context | string | Yes | Context name or index (1-based) from get_contexts |
Exampleโ
Switch to the WEBVIEW_com.example.app context
Supportโ
- Mobile Hybrid Apps
Device Control (Mobile)โ
rotate_deviceโ
Rotates the device to a specific orientation.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
orientation | string | Yes | PORTRAIT or LANDSCAPE |
Supportโ
- Mobile Apps
hide_keyboardโ
Hides the on-screen keyboard.
Parametersโ
None
Supportโ
- Mobile Apps
get_geolocationโ
Gets the current GPS coordinates.
Parametersโ
None
Returnsโ
Object with latitude, longitude, and altitude.
Supportโ
- Mobile Apps
set_geolocationโ
Sets the device GPS coordinates.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
latitude | number | Yes | Latitude coordinate (-90 to 90) |
longitude | number | Yes | Longitude coordinate (-180 to 180) |
altitude | number | No | Altitude in meters |
Exampleโ
Set geolocation to San Francisco (37.7749, -122.4194)
Supportโ
- Mobile Apps
Script Executionโ
execute_scriptโ
Executes JavaScript in the browser or mobile commands via Appium.
Parametersโ
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
script | string | Yes | JavaScript code (browser) or mobile command (e.g., mobile: pressKey) |
args | array | No | Arguments for the script |
Browser Examplesโ
// Get page title
execute_script({ script: "return document.title" })
// Get scroll position
execute_script({ script: "return window.scrollY" })
// Click element by selector
execute_script({ script: "arguments[0].click()", args: ["#myButton"] })
Mobile (Appium) Examplesโ
// Press back key (Android)
execute_script({ script: "mobile: pressKey", args: [{ keycode: 4 }] })
// Activate app
execute_script({ script: "mobile: activateApp", args: [{ appId: "com.example" }] })
// Terminate app
execute_script({ script: "mobile: terminateApp", args: [{ appId: "com.example" }] })
// Deep link
execute_script({ script: "mobile: deepLink", args: [{ url: "myapp://screen", package: "com.example" }] })
// Shell command (Android)
execute_script({ script: "mobile: shell", args: [{ command: "dumpsys", args: ["battery"] }] })
Common Android Key Codesโ
| Key | Code |
|---|---|
| BACK | 4 |
| HOME | 3 |
| ENTER | 66 |
| MENU | 82 |
| SEARCH | 84 |
More Mobile Commandsโ
For a complete list of available Appium mobile commands, see:
- XCUITest Mobile Commands (iOS)
- UiAutomator2 Mobile Commands (Android)
Supportโ
- Desktop Browsers
- Mobile Apps (via Appium mobile commands)