Skip to main content

Use Custom Expressions in Scriptless Test Cases with Java (Selenium & Appium)

Overview

This document explains how to enhance your scriptless test cases by integrating Java custom expressions—methods written using Selenium or Appium. These custom expressions allow testers to handle complex test scenarios by incorporating code snippets within test steps.

Scriptless platforms are built for speed, ease of use, and accessibility. However, certain advanced automation scenarios—such as interacting with hidden UI elements, performing backend validations, or accessing native device settings—require more control than standard action keywords provide.

In such cases, TestGrid’s Custom Expression action keyword enables you to embed Java-based Selenium or Appium code directly into your scriptless test steps. This bridges the gap between no-code testing and traditional automation, allowing testers to address advanced use cases while preserving the simplicity of the scriptless framework.

Step 1: Writing Java Custom Code Snippets Using Scriptless/Codeless.

  • Once the test case is created and opened, write your Java code snippet to handle your specific scenario or functionality.


  • The same steps apply when writing Java code snippets for mobile automation using Appium.

How to Add the Required Import Statements and Libraries Based on Your Codeless Scenario:

Please refer to the link below for more details: https://testgrid.io/docs/document/add-a-import-statements-and-custom-libraries-in-version-suites/

Example:

  1. Web: In Scriptless 

In Code Editor:
For Android:
In Code Editor:
For iOS:

In Code Editor:


You can directly enter your code snippet directly into our “Custom Expression” action keyword UI text area.

Keep Notes While Using the Custom Expression Keyword:

  • Driver Initialization
    • TestGrid runs on a pre-configured Java framework in the background, so there is no need to initialize the WebDriver manually in your custom expression.
    • Attempting to initialize a new driver instance will result in an error.
  • Implicit Waits
    • Avoid using it driver.manage().timeouts().implicitlyWait() within your custom code.
    • TestGrid already provides built-in wait mechanisms, such as the “Wait” action keyword, which should be used instead for handling synchronization.
Table of Contents