> For the complete documentation index, see [llms.txt](https://docs.oxygenhq.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.oxygenhq.org/download-installation-start/start-working-with-oxygen/getting-started-mobile/creating-mobile-test.md).

# Creating a Test - Mobile

For mobile configuration instructions - please refer to [Mobile Installation Guide](/download-installation-start/download-and-installation/mobile-installation.md).

In this guide we will be using the following test scenario to demonstrate how to develop a simple test script:

1. Launch Calculator application.
2. Enter 2x2.
3. Validate that the result is 4.

## Basic Script <a href="#basic-script" id="basic-script"></a>

Oxygen provides a number of built-in objects (modules) for automation purposes. Because in our sample scenario we want to automate only mobile application interactions, we will use the `mob` module. Refer to API Reference for a complete list of provided modules and methods.

1. Launch Calculator application.

   ```javascript
   var caps = {
       platformName: "Android",
       platformVersion: "9.0.1",
       deviceName: "934a9e01",
       appPackage: "com.android.calculator2",
       appActivity: "com.android.calculator2.Calculator",
   };
   mob.init(caps);
   ```

   In the above example , the fields 'AppPackage' and 'AppActivity' are depending on the type of phone you are using, some phones will have different path to their Calculator application. `init` command expects to receive capabilties object defining the application we would like to launch as well as the device specification.
2. Type 2x2

   ```javascript
   mob.click('desc=2');
   mob.click('desc=multiplication');
   mob.click('desc=2');
   ```

   `click` performs tap on an element defined by a locator which will. See API Reference for a list of supported locators.
3. Validate result is 4.

   ```javascript
   mob.assertText('class=android.widget.EditText', '4');
   ```

Entire script:

```javascript
var caps = {
    platformName: "Android",
    platformVersion: "4.2",
    deviceName: "934a9e01",
    appPackage: "com.sec.android.app.popupcalculator",
    appActivity: "com.sec.android.app.popupcalculator.Calculator"
};
mob.init(caps);
mob.click('desc=2');
mob.click('desc=multiplication');
mob.click('desc=2');
mob.assertText('class=android.widget.EditText', '4');
```

Now open a new script in the IDE and paste the above snippet into it. Save the file as `calculator.js`. Switch to the mobile mode by clicking phone icon, select the device on which to run the test from the dropdown menu, and click Run.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.oxygenhq.org/download-installation-start/start-working-with-oxygen/getting-started-mobile/creating-mobile-test.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
