Skip to main content
No Result Found

Configure custom actions using Javascript

Empower your test automation with Custom JavaScript Actions

Sometimes specific test scenarios require automation approaches beyond standard recording capabilities. These limitations present obstacles to comprehensively covering critical application behaviors.

With Custom JavaScript Actions, you can test advanced use cases by executing tailored JavaScript functions within your tests. This enables robust automation coverage even for unsupported or unique scenarios.

How to add custom actions

You can find the new custom actions step in the more menu. Click on the “” icon from the recorder panel and select option “Custom actions (JavaScript)”.

Configure custom actions

Following are the 3 options that are provided when adding a custom action

  1. Custom action
  2. Create variable
  3. Custom validation

Custom action

This option lets you perform any action by executing a javascript snippet on the webpage. This is similar to executing javascript in the console tab. E.g: window.location.reload()

Custom action

Create variable

Use this option to generate a string value using javascript. You are expected to return a string value which will be stored into a variable with a name provided by you. You can import the variable into any of the following steps.

Create variable

Custom validation

Use this option to implement validations that require complex logic, where the recorder’s validation features are not sufficient. The function should return a true or false value. True means the validation passed and false means the validation failed.

Custom validation

You can click on the Execute Script button to execute the step and see the results.

Variable support

You can import any kind(test, data set or module) of variables into the step. The imported variables can be accessed within the function using the below syntax

  • variables.test[‘variable name’] - For any variable from the test scope
  • variables.data[‘variable name’] - For any variable from test datasets
  • variables.module[‘variable name’] - For any variable from modules imported in the test
Note: The custom actions cannot be used within a module in the current version.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle