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
  • Creating Scripts
  • Basic Script

Was this helpful?

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

Creating a Web Test

PreviousRecording a Web TestNextSample Project - Web Test

Last updated 5 years ago

Was this helpful?

Creating Scripts

For Oxygen IDE download instructions - please refer to the .

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

  1. Open Wikipedia website

  2. Select English area

  3. Enter "selenium" in the search field

  4. Press "Search" button

  5. Validate that the page header shows the word "Selenium"

Basic Script

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

  1. Open Wikipedia website.

    web.open('https://www.wikipedia.org/');

    open command accepts only one argument - web site URL. It will open the provided URL and return once the web-page has been fully loaded.

  2. Select English area.

    web.click('id=js-link-box-en');
  3. Enter "selenium" in the search field.

    web.type('name=search', 'selenium');

    type allows typed strings into input elements and accepts two arguments: a locator which will be used for finding the element and a string which will be typed into that element. See API Reference for a list of supported locators.

  4. Press "Search" (looking glass icon) button. This command will return once the web-page has been fully loaded.

    web.click('name=go');

    Similarly to other commands click accepts a locator argument. It will click on the provided element and block until the new page has been fully loaded.

  5. Validate that the page header shows the word "Selenium"

    web.assertText('id=firstHeading', 'Selenium');

    assertText asserts whether the element contains the specified text. This command will fail the test if element doesn't contain the text or wasn't found at all.

Entire script:

web.open('https://www.wikipedia.org/');
web.click('id=js-link-box-en');
web.type('name=search', 'selenium');
web.click('name=go');
web.assertText('id=firstHeading', 'Selenium');

Now open a new script in the IDE and paste the above snippet into it. Save the file as wikipedia.js. In the dropdown menu select the browser you wish to run the script in and click Run.

Download Page