OXYGEN
HomeGitHubReleasesCommunity
  • Welcome to Oxygen
  • About
    • What is Oxygen?
    • Getting Started (Videos)
      • Oxygen IDE Controls Overview
      • Recording a Web Test
      • Oxygen Commands Explained
    • Getting help
  • Download and work with Oxygen
    • Download & Installation
      • Oxygen IDE Installation
      • Oxygen for Mobile Installation
      • Oxygen for Windows Desktop Automation Setup
      • Oxygen for Mac Installation
        • Mac Installation Troubleshooting
      • Oxygen CLI Installation
      • Java Installation Instructions
      • Recording Troubleshooting
    • Start working with Oxygen
      • Getting Started - Web
        • Introduction - Web Testing
        • Recording a Web Test
        • Creating a Web Test
        • Sample Project - Web Test
      • Getting Started - Mobile
        • Introduction - Mobile Testing
        • Recording a Test on Mobile
        • Creating a Test - Mobile
        • Sample Project - Mobile
      • Getting Started - Oxygen for Windows Desktop Automation
      • Getting Started- Oxyge CLI
        • Running a Test Script on Windows
        • Running Multiple Tests (Suites) on Windows
    • Oxygen Modules
      • assert
      • date
      • db
      • email
      • eyes
      • http
      • log
      • mailinator
      • mob
      • pdf
      • proxy
      • serial
      • shell
      • soap
      • twilio
      • utils
      • web
      • win
    • Test Parameters
  • Cloud Providers
    • Sauce Labs
    • Lambda Test
    • TestObject
  • Advanced programming in Oxygen
    • Project Configuration
    • Locating Elements
    • Page Objects
    • Environments
    • Code Components
Powered by GitBook
On this page

Was this helpful?

  1. Download and work with Oxygen
  2. Start working with Oxygen
  3. Getting Started - Mobile

Creating a Test - Mobile

PreviousRecording a Test on MobileNextSample Project - Mobile

Last updated 5 years ago

Was this helpful?

For mobile configuration instructions - please refer to .

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

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.

    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

    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.

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

Entire script:

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.

Mobile Installation Guide