# mob

**Locators:**

Native application locators for![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

* `/XPATH` - Locates element using an XPath 1.0 expression.
* `~ACCESSIBILITY_ID` - Locates element by its Accessibility Id.
* `id=ID` - Locates element by its id.
* `class=CLASS` - Locates element by its class.
* `text=TEXT` - Locates element by its visible text.
* `text-contains=TEXT` - Locates element whose visible text contains the specified string.
* `desc=DESCRIPTION` - Locates element by its description.
* `desc-contains=DESCRIPTION` - Locates element whose description contains the specified string.
* `scrollable` - Locates elements that are scrollable.

Native application locators for![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

* `/XPATH` - Locates element using an XPath 1.0 expression.
* `id=ID` - Locates element by its ID.
* `~ACCESSIBILITY_ID` - Locates element by its Accessibility Id.
* `-ios predicate string:PREDICATE_STRING` - Locates element using a [predicate query](https://github.com/facebookarchive/WebDriverAgent/wiki/Predicate-Queries-Construction-Rules).
* `-ios class chain:CLASS_CHAIN` - Locates element using a [class chain expression](https://github.com/facebookarchive/WebDriverAgent/wiki/Class-Chain-Queries-Construction-Rules).

Hybrid![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) and Web![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media) application locators for![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

* `/XPATH` - Locates element using an XPath 1.0 expression.
* `id=ID` - Locates element by its id.
* `name=NAME` - Locates element by its name attribute.
* `tag=NAME` - Locates element by its tag name.
* `link=TEXT` - Locates anchor element whose text matches the given string.
* `link-contains=TEXT` - Locates anchor element whose text contains the given string.
* `css=CSS_SELECTOR` - Locates element using a CSS selector.

**Pattern arguments:**

Commands which expect a string matching pattern in their arguments, support following patterns unless specified otherwise:

* `regex:PATTERN` - Match using regular expression.
* `PATTERN` - Verbatim matching.

## alertAccept

Accepts an alert or a confirmation dialog.

In case of an alert box this command is identical to `alertDismiss`.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.click("id=Submit");// Clicks an element and opens an alert.
mob.alertAccept();//Automatically press on 'OK' button in the alert pop-up.
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## alertDismiss

Dismisses an alert or a confirmation dialog.

In case of an alert box this command is identical to `alertAccept`.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.click("id=Submit");// Clicks an element and opens an alert.
mob.alertDismiss();//Automatically press on 'Cancel' button in the alert pop-up.
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## assertAlert

Asserts whether alert matches the specified pattern and dismisses it.

Text pattern can be any of the supported string matching patterns(on the top of page).

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.click("id=Submit");// Clicks an element and opens an alert.
mob.assertAlert("Your Alert's text");//Asserts the alert's text.
```

**Parameters:**

| Name      | Type     | Description                                                |
| --------- | -------- | ---------------------------------------------------------- |
| `pattern` | `String` | Text pattern.                                              |
| `timeout` | `Number` | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## assertText

Asserts element's inner text.

Text pattern can be any of the supported string matching patterns (on the top of page). If the element is not interactable, then it will allways return empty string as its text.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.assertText("id=UserName","John Doe");// Asserts if an element’s text is as expected.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `pattern` | `String`            | Assertion text or pattern.                                 |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## assertTitle

Asserts the page title.

Assertion pattern can be any of the supported string matching patterns(on the top of page).

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.assertTitle("Your websites title!");// Asserts if the title of the page.
```

**Parameters:**

| Name      | Type     | Description                                                |
| --------- | -------- | ---------------------------------------------------------- |
| `pattern` | `String` | Assertion text or pattern.                                 |
| `timeout` | `Number` | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## assertValue

Asserts element's value.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.assertValue("id=UserName", "John Doe");// Asserts if the value of an element.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `pattern` | `String`            | Value pattern.                                             |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## back

Navigate backwards in the browser history or simulates back button on Android device.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.click("id=NextPage);// Clicks an element and opens an alert.
mob.back();//Navigate back to previous page.
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## clear

Clears element's value or content

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.type("id=Password", "Password");//Types a password to a field.
mob.clear("id=Password");//Clears the characters from the field of an element.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## click

Clicks on an element.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.click("id=Submit");// Clicks an element.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## clickHidden

Clicks on a non-visible element.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.clickHidden("id=hiddenContent);// Clicks an hidden element.
```

**Parameters:**

| Name          | Type                | Description                                                |
| ------------- | ------------------- | ---------------------------------------------------------- |
| `locator`     | `String`\|`Element` | Element locator.                                           |
| `clickParent` | `Boolean`           | `optional` If true, then parent of the element is clicked. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## clickLong

Performs a long click/touch on an element.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.clickLong("id=Mark",6000);// Clicks an element for a certain duration.
```

**Parameters:**

| Name       | Type                | Description                                                |
| ---------- | ------------------- | ---------------------------------------------------------- |
| `locator`  | `String`\|`Element` | Element locator.                                           |
| `duration` | `Number`            | Touch duration in milliseconds.                            |
| `timeout`  | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## clickMultipleTimes

Performs tap on an element multiple times in quick succession.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.clickMultipleTimes("id=Mark",4);// Clicks an element certain amount of times.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `taps`    | `Number`            | Number of taps.                                            |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## closeApp

Closes the currently open app.

\*\* Usage example:\*\*

```javascript
mob.init(caps); // Starts a mobile session and opens app from desired capabilities
mob.launchApp(); // Launch the app.
mob.closeApp(); // Close the app.
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## debug

Stop test execution and allow interactive command execution (REPL).

\*\* Usage example:\*\*

```javascript
mob.init();
mob.open("www.yourwebsite.com");
mob.debug();
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## dispose

Ends the current session.

**Parameters:**

| Name     | Type     | Description                                          |
| -------- | -------- | ---------------------------------------------------- |
| `status` | `String` | `optional` Test status, either `passed` or `failed`. |

## dragAndDrop

Tap on an element, drag by the specified offset, and release.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.dragAndDrop("id=Mark",-80,100);// Tap on an element, drag by the specified offset, and release.
```

**Parameters:**

| Name      | Type                | Description                                                         |
| --------- | ------------------- | ------------------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator on which to perform the initial tap.                |
| `xoffset` | `Number`            | Horizontal offset. Positive for right direction; Negative for left. |
| `yoffset` | `Number`            | Vertical offset. Positive for down direction; Negative for up.      |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds.          |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## enableNetwork

Enable or disable wifi or data.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.enableNetwork(true,false);//Enable wifi and disable data.
```

**Parameters:**

| Name   | Type      | Description                            |
| ------ | --------- | -------------------------------------- |
| `wifi` | `Boolean` | Enable (true) or disable (false) wifi. |
| `data` | `Boolean` | Enable (true) or disable (false) data. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

## execute

Executes JavaScript in the context of the currently selected frame or window.

If return value is null or there is no return value, `null` is returned.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.execute(function(){
  angular.element("#closeBtn").trigger('ng-click').click()
});//Executes / injects a javascript functions.
```

**Parameters:**

| Name     | Type                 | Description                                                            |
| -------- | -------------------- | ---------------------------------------------------------------------- |
| `script` | `String`\|`Function` | The JavaScript to execute.                                             |
| `arg`    | `...Object`          | `optional` Optional arguments to be passed to the JavaScript function. |

**Returns:**

`Object` - The return value.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## findElement

Finds an element.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
var el = mob.findElement("id=Password");
mob.click(el);
```

**Parameters:**

| Name      | Type      | Description                                                |
| --------- | --------- | ---------------------------------------------------------- |
| `locator` | `String`  | Element locator.                                           |
| `parent`  | `Element` | `optional` Optional parent element for relative search.    |
| `timeout` | `Number`  | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Returns:**

`Element` - A Element object.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## findElements

Finds elements.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
var els = mob.findElements("//div");
for (let el of els) {
 var text = mob.getText(el);
 log.info(text);
}
```

**Parameters:**

| Name      | Type      | Description                                                |
| --------- | --------- | ---------------------------------------------------------- |
| `locator` | `String`  | Element locator.                                           |
| `parent`  | `Element` | `optional` Optional parent element for relative search.    |
| `timeout` | `Number`  | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Returns:**

`Array.<Element>` - Collection of Element objects.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getAlertText

Gets the text displayed by an alert or confirm dialog.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.click("id=Submit");// Clicks an element and opens an alert.
var a = mob.getAlertText();//Gets alert text.
```

**Returns:**

`String` - Alert's text.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getAppiumLogs

Collects logs from the Appium server.

\*\* Usage example:\*\*

```javascript
mob.init(caps); //Starts a mobile session and opens app from desired capabilities
mob.getAppiumLogs(); //Collects logs from the Appium server
```

**Returns:**

`Array.<Object>` - A list of logs.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getBrowserLogs

Collects browser logs from the mobile device.

\*\* Usage example:\*\*

```javascript
mob.init(caps); //Starts a mobile session and opens app from desired capabilities
mob.getBrowserLogs(); //Collects logs from the browser console
```

**Returns:**

`Array.<Object>` - A list of logs.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getCapabilities

Returns currently defined capabilities.

**Returns:**

`Object` - Current capabilities object.

## getCurrentActivity

Gets current Android app's activity name.

\*\* Usage example:\*\*

```javascript
mob.init(caps); // Starts a mobile session and opens app from desired capabilities
let activity = mob.getCurrentActivity(); // Gets current Android activity.
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

## getCurrentPackage

Gets current Android app's package name.

\*\* Usage example:\*\*

```javascript
mob.init(caps); // Starts a mobile session and opens app from desired capabilities
let package = mob.getCurrentPackage(); // Gets current Android package.
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

## getDeviceLogs

Collects logs from the mobile device.

\*\* Usage example:\*\*

```javascript
mob.init(caps); //Starts a mobile session and opens app from desired capabilities
mob.getDeviceLogs(); //Collects logs from the mobile device
```

**Returns:**

`Array.<Object>` - A list of logs.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getDeviceTime

Gets the time on the device.

\*\* Usage example:\*\*

```javascript
mob.init(caps); //Starts a mobile session and opens app from desired capabilities
mob.getDeviceTime(); //Gets the device time
```

**Returns:**

`String` - Time.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## getDriver

Returns the underlying WDIO driver.

**Returns:**

`Object` - WDIO driver.

## getLocation

Get element's location.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
var loc = mob.getLocation("id=element");//Get element's location.
var x = loc.x;
var y = loc.y;
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Returns:**

`Object` - X and Y location of the element relative to top-left page corner.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getSource

Gets the source code of the page.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
var a = mob.getSource();//Gets the source code of the page.
```

**Returns:**

`String` - HTML in case of web or hybrid application or XML in case of native.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getText

Returns the text (rendered text shown to the user; whitespace-trimmed) of an element.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
var a = mob.getText("id=TextArea");//Gets the text from an element.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Returns:**

`String` - Element's text.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getTitle

Returns the title of the currently active window.

**Returns:**

`String` - The page title.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getUrl

Gets the URL of the currently active window.

\*\* Usage example:\*\*

```javascript
mob.init();//Opens browser session.
mob.open("www.yourwebsite.com");// Opens a website.
mob.getUrl();//Gets the url from the current page.
```

**Returns:**

`String` - The page URL.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getValue

Gets element's value (whitespace-trimmed).

\*\* Usage example:\*\*

```javascript
mob.init(caps);
var a = mob.getValue("id=ValueArea");//Gets the value from an element.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Returns:**

`String` - Element's value.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## getWindowHandles

Gets handles of currently open windows.

\*\* Usage example:\*\*

```javascript
mob.init();// Starts a mobile session.
mob.open("www.yourwebsite.com");// Opens a website.
mob.getWindowHandles();//Gets the window handles of currently open windows.
```

**Returns:**

`Array.<String>` - Array of all available window handles.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## hideKeyboard

Hides device keyboard.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.type("id=Password", "Password");//Types a password to a field.
mob.hideKeyboard("pressKey", "Done");//Hides device keyboard.
```

**Parameters:**

| Name       | Type     | Description                                                                                                                |
| ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| `strategy` | `String` | `optional` Strategy to use for closing the keyboard - 'press', 'pressKey', 'swipeDown', 'tapOut', 'tapOutside', 'default'. |
| `key`      | `String` | `optional` Key value if strategy is 'pressKey'.                                                                            |
| `keyCode`  | `String` | `optional` Key code if strategy is 'pressKey'.                                                                             |
| `keyName`  | `String` | `optional` Key name if strategy is 'pressKey'.                                                                             |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## init

Initializes a new Appium session.

**Parameters:**

| Name        | Type     | Description                                                                                         |
| ----------- | -------- | --------------------------------------------------------------------------------------------------- |
| `caps`      | `String` | `optional` Desired capabilities. If not specified capabilities will be taken from suite definition. |
| `appiumUrl` | `String` | `optional` Remote Appium server URL (default: <http://localhost:4723/wd/hub>).                      |

## installApp

Install an app on the remote device.

\*\* Usage example:\*\*

```javascript
mob.init(caps); // Starts a mobile session and opens app from desired capabilities
mob.installApp('/mylocalappfile.apk'); // Install the app.
```

**Parameters:**

| Name           | Type     | Description                             |
| -------------- | -------- | --------------------------------------- |
| `appLocalPath` | `String` | The local file path to APK or IPA file. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## isAppInstalled

Determines if an app is installed on the device.

\*\* Usage example:\*\*

```javascript
mob.init(caps); //Starts a mobile session and opens app from desired capabilities
let installed = mob.isAppInstalled('com.android.calculator2'); // Determines if calculator app is installed.
```

**Parameters:**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `app` | `String` | App's ID.   |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## isCheckable

Determines if checkbox or radio element is checkable.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.isCheckable("id=checkBox");//Determines if checkbox or radio element is checkable.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Returns:**

`Boolean` - true if element is checkable. false otherwise.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

## isChecked

Determines if checkbox or radio element is checked.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.isChecked("id=checkBox");//Determines if checkbox or radio element is checked.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Returns:**

`Boolean` - true if element is checked. false otherwise.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

## isClickable

Determines if an element is clickable.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.isClickable("id=Element");//Determines if element is clickable.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Returns:**

`Boolean` - true if element is clickable. false otherwise.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

## isExist

Wait for an element to become available.

The element is not necessary needs to be visible.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.isExist("id=Element");//Determines if element exists.
```

**Parameters:**

| Name      | Type                | Description                                                                     |
| --------- | ------------------- | ------------------------------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                                                |
| `timeout` | `Number`            | `optional` Time in milliseconds to wait for the element. Default is 60 seconds. |

**Returns:**

`Boolean` - true if the element exists. false otherwise.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## isSelected

Determines if an element is selected.

\*\* Usage example:\*\*

```javascript
mob.init(caps);
var a = mob.isSelected("id=Selection");
if (a) {
 ...
} else {
 ...
}
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                           |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Returns:**

`Boolean` - true if element is selected. false otherwise.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## isVisible

Checks if element is present and visible. Returns false if element was not found or wasn't visible within the specified timeout.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.isVisible("id=Selection");//Determines if element is visible.
```

**Parameters:**

| Name      | Type                | Description                                                                              |
| --------- | ------------------- | ---------------------------------------------------------------------------------------- |
| `locator` | `String`\|`Element` | An element locator.                                                                      |
| `timeout` | `Number`            | `optional` Timeout in milliseconds to wait for element to appear. Default is 60 seconds. |

**Returns:**

`Boolean` - True if element was found and it was visible. False otherwise.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## isWebViewContext

Checks if the current context is of WebView type.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.isWebViewContext();//Checks if the current context is of WebView type.
```

**Returns:**

`Boolean` - true if the context name is WEBVIEW or CHROMIUM.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## launchApp

Launches the app defined in the current session's capabilities.

\*\* Usage example:\*\*

```javascript
mob.init(caps); // Starts a mobile session and opens app from desired capabilities
mob.launchApp(); // Launch the app defined in the session's capabilities.
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## longPressKeyCode

Press and hold a particular key code on the device.

\*\* Usage example:\*\*

```javascript
https://developer.android.com/reference/android/view/KeyEvent.html - list of key codes
mob.init();//Starts a mobile session
mob.open('https://keycode.info/');
mob.longPressKeyCode(32);// 32 - d key
```

**Parameters:**

| Name      | Type     | Description                     |
| --------- | -------- | ------------------------------- |
| `keycode` | `Number` | Key code pressed on the device. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## open

Opens an URL.

The `open` command waits for the page to load before proceeding.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.open('www.yourwebsite.com');//Opens an URL.
```

**Parameters:**

| Name  | Type     | Description                                   |
| ----- | -------- | --------------------------------------------- |
| `url` | `String` | The URL to open; may be relative or absolute. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## pause

Pause test execution for the given amount of milliseconds.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.pause(10*1000);//Pauses the execution for 10 seconds (10000ms)
```

**Parameters:**

| Name | Type     | Description                              |
| ---- | -------- | ---------------------------------------- |
| `ms` | `Number` | Milliseconds to pause the execution for. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## removeApp

Remove an app from the device.

\*\* Usage example:\*\*

```javascript
mob.init(caps); // Starts a mobile session and opens app from desired capabilities
mob.removeApp('com.android.calculator2'); // Remove the calculator app from the device.
```

**Parameters:**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `app` | `String` | App's ID.   |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## resetApp

Reset the currently running app's state (e.g. local settings) on the device.

\*\* Usage example:\*\*

```javascript
mob.init(caps); // Starts a mobile session and opens app from desired capabilities
mob.resetApp(); // Reset curently running app
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## scrollIntoElement

Scrolls the view element until a specified target element inside the view is found.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.scrollIntoElement('id=bottomPanel','id=Button',0,30,50);//Scrolls the view element until a specified target element inside the view is found.
```

**Parameters:**

| Name               | Type     | Description                                                                                                                            |
| ------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `scrollElmLocator` | `String` | View element to scroll.                                                                                                                |
| `findElmLocator`   | `String` | Target element to find in the view.                                                                                                    |
| `xoffset`          | `Number` | `optional` Indicates the size in pixels of the horizontal scroll step (positive - scroll right, negative - scroll left). Default is 0. |
| `yoffset`          | `Number` | `optional` Indicates the size in pixels of the vertical scroll step (positive - scroll down, negative - scroll up). Default is 30.     |
| `retries`          | `Number` | `optional` Indicates the number of scroll retries before giving up if element not found. Default is 50.                                |
| `timeout`          | `Number` | `optional` Timeout in milliseconds. Default is 60 seconds.                                                                             |
| `duration`         | `Number` | `optional` Duration of swipe. Default is 3000 (3sec)                                                                                   |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## scrollIntoView

Scrolls the page or a container element to the location of the specified element.

\*\* Usage example:\*\*

```javascript
mob.scrollIntoView('id=bottomPanel', true);
// or
mob.scrollIntoView('id=bottomPanel', {
 behavior: 'auto', // Optional. Defines the transition animation: `auto` or `smooth`. Defaults to `auto`.
 block: 'start',   // Optional. Defines vertical alignment - `start`, `center`, `end`, `nearest`. Defaults to `start`.
 inline: 'start'   // Optional. Defines horizontal alignment - `start`, `center`, `end`, `nearest`. Defaults to `start`.
});
```

**Parameters:**

| Name      | Type                | Description                                                                                                                                                                                                                                                                                                                                       |
| --------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `locator` | `String`\|`Element` | An element locator.                                                                                                                                                                                                                                                                                                                               |
| `options` | `Boolean`\|`Object` | `optional` If `true`, the top of the element will be aligned to the top of the visible area of the scrollable ancestor. This is the default. If `false`, the bottom of the element will be aligned to the bottom of the visible area of the scrollable ancestor. This parameter can also accept an `options` object. See the usage example above. |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds.                                                                                                                                                                                                                                                                                        |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## select

Selects an option from a drop-down list using an option locator. This command works with multiple-choice lists as well.

Option locator can be one of the following (No prefix is same as label matching):\
\- `label=STRING` - Matches option based on the visible text.\
\- `value=STRING` - Matches option based on its value.\
\- `index=STRING` - Matches option based on its index. The index is 0-based.

\*\* Usage example:\*\*

```javascript
mob.init(); //Starts a mobile session
mob.open("www.yourwebsite.com");// Opens a website.
mob.select("id=Selection","label=United States");// Selects an option from a list.
```

**Parameters:**

| Name            | Type     | Description                                                |
| --------------- | -------- | ---------------------------------------------------------- |
| `selectLocator` | `String` | An element locator identifying a drop-down menu.           |
| `optionLocator` | `String` | An option locator.                                         |
| `timeout`       | `Number` | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## selectFrame

Selects a frame or an iframe within the current window.

Available frame locators:\
\- `'parent'` - Select parent frame.\
\- `'top'` - Select top window.\
\- `NUMBER` - Select frame by its 0-based index.\
\- `LOCATOR` - Locator identifying the frame (relative to the top window). Multiple locators can be passed in order to switch between nested frames.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.selectFrame("//iframe[@id='frame1']", "//iframe[@id='nested_frame']");
```

**Parameters:**

| Name           | Type                  | Description                                                                    |
| -------------- | --------------------- | ------------------------------------------------------------------------------ |
| `frameLocator` | `...String`\|`Number` | `optional` A locator identifying the frame or iframe. Or a series of locators. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## selectWindow

Selects window. Once window has been selected, all commands go to that window.

`windowLocator` can be:

* `title=TITLE` Switch to the first window which matches the specified title. `TITLE` can be any ofthe supported string matching patterns (see top of the page). When using title locator, this commandwill wait for the window to appear first similarly to `waitForWindow` command.
* `url=URL` Switch to the first window which matches the specified URL. `URL` can be any ofthe supported string matching patterns (see top of the page). When using url locator, this commandwill wait for the window to appear first similarly to `waitForWindow` command.
* `windowHandle` Switch to a window using its unique handle.

\*\* Usage example:\*\*

```javascript
mob.init();// Starts a mobile session.
mob.open("www.yourwebsite.com");// Opens a website.
mob.selectWindow("title=Website");// Selects and focus a window.
```

**Parameters:**

| Name            | Type     | Description                                                                                            |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------ |
| `windowLocator` | `String` | `optional` Window locator.                                                                             |
| `timeout`       | `Number` | `optional` Timeout in milliseconds when using 'title' window locating strategy. Default is 60 seconds. |

**Returns:**

`String` - windowHandle of the previously selected window.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## sendKeys

Send a sequence of keyboard strokes to the active window or element.

Refer to [Key Codes](https://w3c.github.io/webdriver/#keyboard-actions) for the list of supported raw keyboard key codes.

\*\* Usage example:\*\*

```javascript
mob.init();//Opens browser session.
mob.open("www.yourwebsite.com");// Opens a website.
mob.sendKeys("Hello World");
mob.sendKeys(["Backspace", "Backspace", "Enter"]); // send two Backspace key codes and Enter.
// Unicode representation can be used directly as well:
mob.sendKeys("Hello World\uE003\uE003\uE007");
```

**Parameters:**

| Name    | Type                       | Description                                                                                               |
| ------- | -------------------------- | --------------------------------------------------------------------------------------------------------- |
| `value` | `String`\|`Array.<String>` | Sequence of key strokes to send. Can be either a string or an array of strings for sending raw key codes. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## setContext

Sets a specific context (NATIVE\_APP, WEBVIEW, etc.).

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.setContext('NATIVE_APP');//Sets a specific context (NATIVE_APP, WEBVIEW, etc.).
```

**Parameters:**

| Name      | Type     | Description       |
| --------- | -------- | ----------------- |
| `context` | `String` | The context name. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## setNativeContext

Sets context to NATIVE\_APP.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.setNativeContext();//Sets context to NATIVE_APP.
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## setTimeout

Specifies the amount of time that Oxygen will wait for actions to complete.

This includes the `open` command, `waitFor*` commands, and commands which wait for elements to appear in DOM or become visible before operating on them.\
If command wasn't able to complete within the specified period it will fail the test.\
The default time-out is 60 seconds.

\*\* Usage example:\*\*

```javascript
mob.init();//Opens browser session.
mob.setTimeout(60000);//Sets the time out to amount of milliseconds .
```

**Parameters:**

| Name      | Type     | Description                 |
| --------- | -------- | --------------------------- |
| `timeout` | `Number` | A time-out in milliseconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## setWebViewContext

Sets context to the first available WEBVIEW or CHROMIUM (Crosswalk WebView) view.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.setWebViewContext();//Sets context to the first available WEBVIEW or CHROMIUM (Crosswalk WebView) view.
```

**Returns:**

`String` - Context name, or null if no web context found.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## shake

Perform shake action on the device

Supported on Android and iOS 9 or earlier versions.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.shake();//Perform shake action on the device.
```

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## smsClickLink

Clicks SMS message URL.

`SMSPopup` application must be installed and running on the device to use this command. <https://github.com/oxygenhq/android-smspopup/releases>

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.click("id=sendSmS");// Clicks an element.
mob.smsClickLink(60000);//Clicks SMS message URL.
```

**Parameters:**

| Name      | Type     | Description                                                                   |
| --------- | -------- | ----------------------------------------------------------------------------- |
| `timeout` | `Number` | `optional` Time in milliseconds to wait for sms popup. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

## smsGetText

Gets SMS text on Android phone.

`SMSPopup` application must be installed and running on the device to use this command. <https://github.com/oxygenhq/android-smspopup/releases>

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.click("id=sendSmS");// Clicks an element.
var a = mob.smsGetText(60000);//Gets SMS text on Android phone.
```

**Parameters:**

| Name      | Type     | Description                                                                   |
| --------- | -------- | ----------------------------------------------------------------------------- |
| `timeout` | `Number` | `optional` Time in milliseconds to wait for sms popup. Default is 60 seconds. |

**Returns:**

`String` - SMS text.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

## swipe

Perform a swipe on an element.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.swipe("id=Element",-60,0,150);//Perform a swipe on the screen or an element.
```

**Parameters:**

| Name       | Type                | Description                                                                                   |
| ---------- | ------------------- | --------------------------------------------------------------------------------------------- |
| `locator`  | `String`\|`Element` | Locator of the element to swipe on.                                                           |
| `xoffset`  | `Number`            | `optional` Horizontal offset (positive - scroll right, negative - scroll left). Default is 0. |
| `yoffset`  | `Number`            | `optional` Vertical offset (positive - scroll down, negative - scroll up). Default is 30.     |
| `timeout`  | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds.                                    |
| `duration` | `Number`            | `optional` Duration of swipe. Default is 3000 (3sec)                                          |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## swipeElement

Perform swipe on the element.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.swipeElement("id=Element",-60,0,150);//Perform a swipe on the screen or an element.
```

**Parameters:**

| Name       | Type     | Description                                                                                   |
| ---------- | -------- | --------------------------------------------------------------------------------------------- |
| `locator`  | `String` | Locator of the element to swipe on.                                                           |
| `xoffset`  | `Number` | `optional` Horizontal offset (positive - scroll right, negative - scroll left). Default is 0. |
| `yoffset`  | `Number` | `optional` Vertical offset (positive - scroll down, negative - scroll up). Default is 30.     |
| `timeout`  | `Number` | `optional` Timeout in milliseconds. Default is 60 seconds.                                    |
| `duration` | `Number` | `optional` Duration of swipe. Default is 3000 (3sec)                                          |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## swipeScreen

Perform a swipe on the screen.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.swipeScreen(0, 0, 0, 900);//Perform a swipe on the screen
```

**Parameters:**

| Name       | Type     | Description                                                |
| ---------- | -------- | ---------------------------------------------------------- |
| `x1`       | `Number` | Starting X position (top-left screen corner is the origin) |
| `y1`       | `Number` | Starting Y position.                                       |
| `x2`       | `Number` | Ending X position.                                         |
| `y2`       | `Number` | Ending Y position.                                         |
| `duration` | `Number` | `optional` Duration of swipe. Default is 3000 (3sec)       |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## takeScreenshot

Take a screenshot of the current page or screen and return it as base64 encoded string.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
var ss = mob.takeScreenshot();//Take a screenshot of the current page or screen and return it as base64 encoded string.
require("fs").writeFileSync("c:\\screenshot.png", ss, 'base64');
```

**Returns:**

`String` - Screenshot image encoded as a base64 string.

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## tap

Perform tap at the specified coordinate.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.tap(60,300);//Perform tap at the specified coordinate.
```

**Parameters:**

| Name | Type     | Description |
| ---- | -------- | ----------- |
| `x`  | `Number` | x offset.   |
| `y`  | `Number` | y offset.   |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media)

## transaction

Opens new transaction.

The transaction will persist till a new one is opened. Transaction names must be unique.

**Parameters:**

| Name   | Type     | Description           |
| ------ | -------- | --------------------- |
| `name` | `String` | The transaction name. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## type

Send a sequence of key strokes to an element (clears value before).

Refer to [Key Codes](https://w3c.github.io/webdriver/#keyboard-actions) for the list of supported raw keyboard key codes.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.type('id=TextArea', 'hello world\uE007');
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | An element locator.                                        |
| `value`   | `String`            | The value to type.                                         |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## unlockPattern

Unlocks a pattern lock

**:**

```
1 2 3
4 5 6
7 8 9
a b c
```

**Parameters:**

| Name      | Type                | Description                                                             |
| --------- | ------------------- | ----------------------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator for the pattern lock.                                   |
| `cols`    | `Number`            | Number of columns in the pattern.                                       |
| `rows`    | `Number`            | Number of rows in the pattern.                                          |
| `pattern` | `String`            | Pattern sequence. Pins are hexadecimal and case sensitive. See example. |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds.              |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media)

## waitForExist

Wait for an element for the provided amount of milliseconds to exist in DOM.

The element is not necessary needs to be visible.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.waitForExist('id=Element');//Wait for an element for the provided amount of milliseconds to exist in DOM.
```

**Parameters:**

| Name      | Type                | Description                                                                     |
| --------- | ------------------- | ------------------------------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                                                |
| `timeout` | `Number`            | `optional` Time in milliseconds to wait for the element. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## waitForInteractable

Waits for element to become interactable.

\*\* Usage example:\*\*

```javascript
mob.init();//Opens browser session.
mob.waitForInteractable("id=UserName");//Waits for an element is clickable in DOM.
```

**Parameters:**

| Name      | Type                | Description                                                |
| --------- | ------------------- | ---------------------------------------------------------- |
| `locator` | `String`\|`Element` | An element locator.                                        |
| `timeout` | `Number`            | `optional` Timeout in milliseconds. Default is 60 seconds. |

**Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)

## waitForVisible

Waits for element to become visible.

\*\* Usage example:\*\*

```javascript
mob.init(caps);//Starts a mobile session and opens app from desired capabilities
mob.waitForVisible("id=Title", 45*1000);//Waits for an element to  be visible.
```

**Parameters:**

| Name      | Type                | Description                                                                     |
| --------- | ------------------- | ------------------------------------------------------------------------------- |
| `locator` | `String`\|`Element` | Element locator.                                                                |
| `timeout` | `Number`            | `optional` Time in milliseconds to wait for the element. Default is 60 seconds. |

> **Supported On**: ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYgv7H6u3PgSgCn%2Fandroid.png?generation=1579863734096034\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYj4jzbe0FF-lfz%2Fapple.png?generation=1579863736749903\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYlcIVyA_03dlwr%2Fhybrid.png?generation=1579863730371201\&alt=media) ![](https://3998735799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lwyvw09Dn_2O4RFZKxE%2F-LzMCjsAQ5W3Q-bVSXnY%2F-LzMCnYnarLXRJuo9Y-H%2Fweb.png?generation=1579863728963327\&alt=media)
