Skip to main content

Tools

The WebdriverIO MCP server exposes 29 tools organized by function. Tools marked browser-only require a platform: "browser" session. Tools marked mobile-only require platform: "ios" or platform: "android".

Session Managementโ€‹

start_sessionโ€‹

Starts a new browser or mobile automation session. Only one active session at a time; starting a new one closes the existing one.

ParameterTypeRequiredDefaultDescription
platform"browser" | "ios" | "android"โœ“โ€”Session platform
provider"local" | "browserstack" | "saucelabs" | "testmu" | "testingbot"โ€”"local"Session provider
browser"chrome" | "firefox" | "edge" | "safari"browser onlyโ€”Browser to launch
browserVersionstringโ€”latestBrowser version (cloud providers only, default: latest)
osstringโ€”โ€”Operating system (cloud providers only, e.g. "Windows", "OS X")
osVersionstringโ€”โ€”OS version (cloud providers only, e.g. "11", "Sequoia")
headlessbooleanโ€”trueRun browser headlessly
windowWidthnumberโ€”1920Browser window width (400โ€“3840)
windowHeightnumberโ€”1080Browser window height (400โ€“2160)
navigationUrlstringโ€”โ€”URL to navigate to after starting
deviceNamestringmobile onlyโ€”Device/emulator/simulator name
platformVersionstringโ€”โ€”OS version (e.g. "17.0", "14")
appPathstringโ€”โ€”Path to .app / .apk / .ipa
appstringโ€”โ€”App URL (bs://... for BrowserStack, storage:filename= for Sauce Labs, lt://... for TestMu, TestingBot app_url) or custom_id
automationName"XCUITest" | "UiAutomator2"โ€”autoAutomation driver
autoGrantPermissionsbooleanโ€”trueAuto-grant app permissions
autoAcceptAlertsbooleanโ€”trueAuto-accept alerts
autoDismissAlertsbooleanโ€”falseAuto-dismiss alerts
appWaitActivitystringโ€”โ€”Android activity to wait for on launch
udidstringโ€”โ€”iOS real device UDID
noResetbooleanโ€”โ€”Preserve app data between sessions
fullResetbooleanโ€”โ€”Uninstall app before/after session
newCommandTimeoutnumberโ€”300Appium command timeout (seconds)
attachbooleanโ€”falseAttach to existing Chrome via CDP
attachConfigobjectโ€”โ€”CDP connection: { port: 9222, host: "localhost" }
appiumConfigobjectโ€”โ€”Appium server: { host, port, path }
tunnelboolean | "external"โ€”falseLocal tunnel routing (cloud providers). true = auto-start, "external" = tunnel already running externally
reportingobjectโ€”โ€”Cloud provider reporting labels: { project, build, session }
tracebooleanโ€”falseEnable trace recording โ€” produces a Playwright-compatible .trace zip
region"us-west-1" | "eu-central-1" | "apac-southeast-1"โ€”"eu-central-1"Sauce Labs data center region
tunnelNamestringโ€”โ€”Tunnel identifier name (required for tunnel: "external")
capabilitiesobjectโ€”โ€”Additional raw capabilities to merge
// Local Chrome browser
start_session({ platform: "browser", browser: "chrome" })

// iOS simulator
start_session({ platform: "ios", deviceName: "iPhone 16", platformVersion: "18.0", appPath: "/path/to/app.app" })

// BrowserStack Android
start_session({ platform: "android", provider: "browserstack", deviceName: "Samsung Galaxy S24", app: "bs://abc123" })

// Sauce Labs iOS
start_session({ platform: "ios", provider: "saucelabs", deviceName: "iPhone 15", platformVersion: "17.0", app: "storage:filename=MyApp.ipa" })

// TestMu browser
start_session({ platform: "browser", provider: "testmu", browser: "chrome", os: "Windows", osVersion: "11" })

// TestingBot browser
start_session({ platform: "browser", provider: "testingbot", browser: "chrome", os: "Windows", osVersion: "11" })

// Cloud provider with tunnel
start_session({ platform: "browser", provider: "browserstack", browser: "chrome", tunnel: true })

// Attach to existing Chrome (after launch_chrome)
start_session({ platform: "browser", browser: "chrome", attach: true })

close_sessionโ€‹

Closes or detaches from the current session.

ParameterTypeRequiredDefaultDescription
detachbooleanโ€”falseDisconnect without terminating (preserves app state on Appium)

Sessions started with noReset: true auto-detach by default.


launch_chromeโ€‹

Prepares a Chrome instance with remote debugging enabled so start_session({ attach: true }) can connect. Two modes:

  • newInstance (default): opens Chrome alongside your existing one using a separate profile directory; your current session is untouched.
  • freshSession: launches Chrome with an empty profile (no cookies, no logins). Use copyProfileFiles: true to carry over cookies and logins.
ParameterTypeRequiredDefaultDescription
portnumberโ€”9222Remote debugging port
mode"newInstance" | "freshSession"โ€”"newInstance"Launch mode
copyProfileFilesbooleanโ€”falseCopy Chrome Default profile (cookies, logins) into debug session

After this tool succeeds, call start_session({ platform: "browser", browser: "chrome", attach: true }).


Loads a URL in the current tab and waits for the page load event. Resets page state (DOM, JS runtime). Browser-only.

ParameterTypeRequiredDescription
urlstringโœ“URL to navigate to

get_tabsโ€‹

Lists all browser tabs with handle, title, URL, and which is active. Use before switch_tab to find the target handle. Browser-only.

No parameters.


switch_tabโ€‹

Focuses a browser tab by window handle or 0-based index. All subsequent tool calls operate on the newly active tab. Browser-only.

ParameterTypeRequiredDescription
handlestringโ€”Window handle to switch to
indexnumberโ€”0-based tab index (โ‰ฅ 0)

Provide either handle or index. Get handles from get_tabs or wdio://session/current/tabs.


switch_frameโ€‹

Switches WebDriver frame context into an iframe by CSS/XPath selector, or back to top-level if selector is omitted. Changes persist; all subsequent click_element, set_value, get_elements calls operate within the switched frame until you switch back. Waits up to 5s for the iframe. Browser-only.

ParameterTypeRequiredDescription
selectorstringโ€”CSS/XPath selector for the iframe element. Omit to switch back to the top-level frame.
// Switch into an iframe
switch_frame({ selector: "#my-iframe" })

// Interact with elements inside the iframe
click_element({ selector: "button.submit" })

// Switch back to top-level
switch_frame()

Element Interactionโ€‹

click_elementโ€‹

Waits for an element to exist, scrolls it into view, and clicks it. Works on browser and mobile. On iOS, prefer tap_element; click_element is sometimes ignored by the native layer.

ParameterTypeRequiredDefaultDescription
selectorstringโœ“โ€”CSS, XPath, or text selector
scrollToViewbooleanโ€”trueScroll element into view before clicking
timeoutnumberโ€”โ€”Max wait time (ms)

set_valueโ€‹

Clears an input or textarea and types the given text. Always replaces existing content.

ParameterTypeRequiredDefaultDescription
selectorstringโœ“โ€”CSS, XPath, or text selector
valuestringโœ“โ€”Text to type
scrollToViewbooleanโ€”trueScroll element into view before typing
timeoutnumberโ€”โ€”Max wait time (ms)

scrollโ€‹

Scrolls the page by a number of pixels. Browser-only. For mobile, use swipe.

ParameterTypeRequiredDefaultDescription
direction"up" | "down"โœ“โ€”Scroll direction
pixelsnumberโ€”500Pixels to scroll

Element Analysisโ€‹

get_elementsโ€‹

Returns interactable elements on the current page with selectors ready to use. Prefer the wdio://session/current/elements resource for ambient awareness; use this tool when you need filtering or pagination.

ParameterTypeRequiredDefaultDescription
inViewportOnlybooleanโ€”falseOnly return viewport-visible elements
includeContainersbooleanโ€”falseInclude container elements (divs, sections)
includeBoundsbooleanโ€”falseInclude bounding box coordinates
limitnumberโ€”0Max elements to return (0 = unlimited)
offsetnumberโ€”0Elements to skip (pagination)

get_accessibility_treeโ€‹

Returns the page accessibility tree with roles, names, and selectors. Supports filtering and pagination. Browser-only.

ParameterTypeRequiredDefaultDescription
limitnumberโ€”0Max nodes to return (0 = unlimited)
offsetnumberโ€”0Nodes to skip (pagination)
rolesstring[]โ€”โ€”Filter by ARIA roles, e.g. ["button", "link", "heading"]

Screenshotsโ€‹

get_screenshotโ€‹

Takes a screenshot of the current page or screen. Returns a base64-encoded image, automatically resized and compressed to stay within model context limits (max 1 MB, max 2000px).

No parameters. Prefer wdio://session/current/elements over screenshots for element discovery; it's faster and uses far fewer tokens. Use screenshots for visual verification or debugging layout.


get_cookiesโ€‹

Returns all cookies for the current session, or a single cookie by name. Browser-only.

ParameterTypeRequiredDescription
namestringโ€”Cookie name. Omit to return all cookies.

Sets a browser cookie. The browser must already be on the target domain โ€” cookies cannot be set cross-domain. Use to inject session tokens or feature flags without going through login flows. Browser-only.

ParameterTypeRequiredDescription
namestringโœ“Cookie name
valuestringโœ“Cookie value
domainstringโ€”Cookie domain (defaults to current domain)
pathstringโ€”Cookie path (defaults to /)
expirynumberโ€”Expiry as Unix timestamp (seconds)
httpOnlybooleanโ€”HttpOnly flag
securebooleanโ€”Secure flag
sameSite"strict" | "lax" | "none"โ€”SameSite attribute

delete_cookiesโ€‹

Deletes all cookies or a specific cookie by name. Browser-only.

ParameterTypeRequiredDescription
namestringโ€”Cookie name to delete. Omit to delete all cookies.

Touch Gestures (Mobile)โ€‹

tap_elementโ€‹

Calls element.tap() on a matched element or taps at absolute screen coordinates. Use on iOS when click_element is ignored; tap is the native gesture iOS responds to. Mobile-only.

ParameterTypeRequiredDescription
selectorstringโ€”Element selector
xnumberโ€”X coordinate for screen tap (if no selector)
ynumberโ€”Y coordinate for screen tap (if no selector)

Provide either selector or x/y coordinates.


swipeโ€‹

Performs a full-screen swipe gesture. Direction is content movement direction (e.g. "up" scrolls a list upward). Use for scrolling beyond visible bounds. For moving a specific element, use drag_and_drop. Mobile-only. For browsers, use scroll.

ParameterTypeRequiredDefaultDescription
direction"up" | "down" | "left" | "right"โœ“โ€”Swipe direction
durationnumberโ€”500Swipe duration (ms, 100โ€“5000)
percentnumberโ€”0.5 / 0.95Fraction of screen to swipe (0โ€“1)

drag_and_dropโ€‹

Drags an element to another element or coordinates. Mobile-only.

ParameterTypeRequiredDefaultDescription
sourceSelectorstringโœ“โ€”Source element to drag
targetSelectorstringโ€”โ€”Target element to drop onto
xnumberโ€”โ€”Target X offset (if no targetSelector)
ynumberโ€”โ€”Target Y offset (if no targetSelector)
durationnumberโ€”โ€”Drag duration (ms, 100โ€“5000)

Context Switching (Mobile)โ€‹

get_contextsโ€‹

Returns available automation contexts and the currently active one. Use before switch_context to discover NATIVE_APP and WEBVIEW_* targets. Mobile-only.

No parameters.


switch_contextโ€‹

Switches between native and webview automation contexts in a hybrid mobile app. Required before using CSS/XPath selectors inside an embedded webview. Mobile-only.

ParameterTypeRequiredDescription
contextstringโœ“Context name, e.g. "NATIVE_APP", "WEBVIEW_com.example.app"

Get available context names from get_contexts or wdio://session/current/contexts.

// 1. Check what's available
get_contexts()
// โ†’ { contexts: ["NATIVE_APP", "WEBVIEW_com.example.app"], currentContext: "NATIVE_APP" }

// 2. Switch into the webview for CSS/XPath
switch_context({ context: "WEBVIEW_com.example.app" })

// 3. Interact with webview elements using CSS selectors
click_element({ selector: "#login-button" })

// 4. Switch back to native for native UI
switch_context({ context: "NATIVE_APP" })

Device Control (Mobile)โ€‹

rotate_deviceโ€‹

Rotates the device to portrait or landscape and waits for the OS rotation to complete. Use to test orientation-dependent layouts. Mobile-only.

ParameterTypeRequiredDescription
orientation"PORTRAIT" | "LANDSCAPE"โœ“Target orientation

hide_keyboardโ€‹

Dismisses the software keyboard. Call after text entry when the keyboard obscures elements you need next. No-op if already hidden. Mobile-only.

No parameters.


set_geolocationโ€‹

Overrides device GPS coordinates for the session. Affects navigator.geolocation on web and location services on mobile. Location permissions must be granted to the app beforehand.

ParameterTypeRequiredDescription
latitudenumberโœ“Latitude (โˆ’90 to 90)
longitudenumberโœ“Longitude (โˆ’180 to 180)
altitudenumberโ€”Altitude in metres

App Lifecycle (Mobile)โ€‹

get_app_stateโ€‹

Returns the current lifecycle state of a mobile app. Mobile-only.

ParameterTypeRequiredDescription
bundleIdstringโœ“iOS bundle ID or Android package name, e.g. "com.example.app"

Returns one of: not installed, not running, background (suspended), background, foreground.


Browser Utilitiesโ€‹

emulate_deviceโ€‹

Emulates a mobile or tablet device in the current browser session (sets viewport, DPR, user-agent, touch events). Requires a BiDi-enabled session: start_session({ capabilities: { webSocketUrl: true } }). Browser-only.

ParameterTypeRequiredDescription
devicestringโ€”Device preset name (e.g. "iPhone 15", "Pixel 7"). Omit to list presets. Pass "reset" to restore desktop defaults.

execute_scriptโ€‹

Executes JavaScript in the browser or mobile commands via Appium.

ParameterTypeRequiredDescription
scriptstringโœ“JS code (browser) or Appium command like "mobile: pressKey"
argsany[]โ€”Arguments passed to the script or command

Browser: use return to get values back.

// Get page title
execute_script({ script: "return document.title" })

// Scroll element into view
execute_script({ script: "arguments[0].scrollIntoView()", args: ["#my-element"] })

Mobile (Appium): uses mobile: <command> syntax.

// Press Android back key
execute_script({ script: "mobile: pressKey", args: [{ keycode: 4 }] })

// Activate app (iOS/Android)
execute_script({ script: "mobile: activateApp", args: [{ bundleId: "com.example.app" }] })

// Deep link (iOS)
execute_script({ script: "mobile: deepLink", args: [{ url: "myapp://route", bundleId: "com.example.app" }] })

Cloud Providersโ€‹

list_appsโ€‹

Lists apps uploaded to a cloud provider (BrowserStack App Automate, Sauce Labs App Storage, TestMu, or TestingBot Storage). Reads provider-specific credentials from environment.

ParameterTypeRequiredDefaultDescription
provider"browserstack" | "saucelabs" | "testmu" | "testingbot"โœ“โ€”Cloud provider
sortBy"app_name" | "uploaded_at"โ€”"uploaded_at"Sort order
organizationWidebooleanโ€”false(BrowserStack only) List all org uploads
limitnumberโ€”20Max results
region"us-west-1" | "eu-central-1" | "apac-southeast-1"โ€”"eu-central-1"Sauce Labs region
// List all four providers
list_apps({ provider: "browserstack" })
list_apps({ provider: "saucelabs", region: "us-west-1" })
list_apps({ provider: "testmu" })
list_apps({ provider: "testingbot" })

upload_appโ€‹

Uploads a local .apk or .ipa to a cloud provider (BrowserStack, Sauce Labs, TestMu, or TestingBot). Returns the app URL for use in start_session.

ParameterTypeRequiredDefaultDescription
provider"browserstack" | "saucelabs" | "testmu" | "testingbot"โœ“โ€”Cloud provider
pathstringโœ“โ€”Absolute path to the .apk or .ipa file
customIdstringโ€”โ€”Optional custom ID for referencing the app later
region"us-west-1" | "eu-central-1" | "apac-southeast-1"โ€”"eu-central-1"Sauce Labs region
// Upload to each provider
upload_app({ provider: "browserstack", path: "/path/to/app.apk" })
upload_app({ provider: "saucelabs", path: "/path/to/app.ipa", region: "us-west-1" })
upload_app({ provider: "testmu", path: "/path/to/app.apk" })
upload_app({ provider: "testingbot", path: "/path/to/app.apk" })

Welcome! How can I help?

WebdriverIO AI Copilot