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
  • decrypt
  • dnsResolve
  • encrypt
  • pause
  • readCsv
  • readXlsx
  • transaction
  • writeCsv
  • xmlToJson

Was this helpful?

  1. Download and work with Oxygen
  2. Oxygen Modules

utils

Provides miscellaneous utility methods.

decrypt

Decrypt text

** Usage example:**

// to encrypt plaintext into ciphertext 
const encrypt = utils.encrypt('https://www.wikipedia.org');
log.info(encrypt); // will print b757ba2c2fc50fbb511d596816ca06c4fa56f4e98ce222f30bc58d5251ed635e

// to decrypt ciphertext and use it in script  
const decrypt = utils.decrypt(encrypt);
log.info(decrypt); // will print ENCRYPTED

web.init();
web.open(decrypt); // will open https://www.wikipedia.org

// to get original plaintext use getDecryptResult
const value = decrypt.getDecryptResult();
log.info(value); //will print https://www.wikipedia.org

Parameters:

Name
Type
Description

text

String

Text

Returns:

Object - DecryptResult Object with getDecryptResult method

dnsResolve

Uses the DNS protocol to resolve a host name

Parameters:

Name
Type
Description

hostname

String

Host name to resolve.

rrType

String

optional Resource record type. Default: 'A'.

Returns:

(Array.<String>|Object) - Array or Object of resource records. The type and structure of individual results vary based on rrtype

encrypt

Encrypt text

** Usage example:**

// to encrypt plaintext into ciphertext 
const encrypt = utils.encrypt('https://www.wikipedia.org');
log.info(encrypt); // will print b757ba2c2fc50fbb511d596816ca06c4fa56f4e98ce222f30bc58d5251ed635e

// to decrypt ciphertext and use it in script  
const decrypt = utils.decrypt(encrypt);
log.info(decrypt); // will print ENCRYPTED

web.init();
web.open(decrypt); // will open https://www.wikipedia.org

// to get original plaintext use getDecryptResult
const value = decrypt.getDecryptResult();
log.info(value); //will print https://www.wikipedia.org

Parameters:

Name
Type
Description

text

String

Text

Returns:

String - Encrypted text

pause

Pause test execution for the given amount of milliseconds.

Parameters:

Name
Type
Description

ms

Number

Milliseconds to pause the execution for.

readCsv

Reads data from csv file

Parameters:

Name
Type
Description

filePath

String

Absolute path to file

options

Object

readXlsx

Reads data from Xlsx file

Parameters:

Name
Type
Description

filePath

String

Absolute path to file

Returns:

Array - Array of xlsx data

transaction

Opens new transaction.

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

Parameters:

Name
Type
Description

name

String

The transaction name.

writeCsv

Writes data into csv file

Parameters:

Name
Type
Description

filePath

String

Absolute path to file

data

Array

CSV data in format [{column_name_1: 'foo', column_name_2: 'bar'}]

options

Object

xmlToJson

Parse XML data to JS object

Parameters:

Name
Type
Description

xmlDataStr

string|Buffer

Like

options

boolean|Object

PrevioustwilioNextweb

Last updated 1 year ago

Was this helpful?

optional

optional

Options
Options
Options