Supported Commands
The Mobilecli engine is in beta and supports a part of the WebdriverIO API. This page lists what works today. A command that is not listed fails with:
The command "<name>" is not supported by @wdio/mobilecli-driver
The name in that message is the protocol command that WebdriverIO sent, which can differ from the command in your test. For example $('~login').click({ x: 10 }) reports performActions.
Supported​
| Command | Notes |
|---|---|
$(selector) | Accessibility id (~), id (id=) and class name, see Selectors. |
$$(selector) | Accessibility id (~), id (id=) and class name, see Selectors. |
$(selector).click() | A tap in the middle of the element, without options. |
$(selector).tap() | A tap in the middle of the element, without options. browser.tap() is not supported yet. |
$(selector).setValue() | string and number values. { mask: true } works. |
$(selector).addValue() | string and number values. { mask: true } works. |
$(selector).clearValue() | |
$(selector).getText() | The text, else the label, else the value, see Read an element. |
$(selector).getValue() | See Read an element. |
$(selector).isDisplayed() | Does not wait. |
$(selector).isEnabled() | Does not wait. |
$(selector).waitForExist() | Also with reverse: true. |
$(selector).waitForDisplayed() | Also with reverse: true. |
$(selector).waitForEnabled() | Also with reverse: true. |
browser.hideKeyboard() | Takes no strategy. |
browser.isKeyboardShown() | |
browser.getPageSource() | Returns JSON, not XML. |
browser.setTimeout() | Only implicit, which sets the timeout of the engine, see Timeouts. |
The expect matchers that use these commands work as well, such as toHaveText(), toBeDisplayed() and toBeEnabled().
Not supported yet​
These work with Appium and are not built for the Mobilecli engine yet:
| Area | Examples |
|---|---|
| Selectors | XPath, -ios predicate string, -ios class chain, -android uiautomator, chained $('~list').$('~item') |
| Gestures | swipe(), scrollIntoView(), longPress(), pinch(), zoom(), dragAndDrop(), click() and tap() with options, browser.tap({ x, y }) |
| Screen | takeScreenshot(), saveScreenshot(), orientation |
| Apps during a test | launchApp(), closeApp(), installing or stopping an app. To start an app, use mobilecli:app. |
| Hybrid apps | getContexts(), switchContext(), webviews |
| Sessions | browser.reloadSession(), attaching to a running session |
| Device clouds | Only local devices are supported. Support for device clouds is in progress. |
| Other mobile commands | The other mobile commands and mobile: scripts with browser.execute() |
More commands and selectors are added during the beta. To run a test that needs one of them today, run it with Appium: see Run the same tests with Appium.