Context Clicks
The Context Click feature lets you automate a click on an element based on nearby reference text. Instead of relying only on fixed selectors, the engineer can define a relationship between a reference and a target element.
This makes test steps more flexible and reusable. For example, instead of creating separate steps for each product, file, or task, the engineer can parameterize the reference text and use the same step for multiple scenarios.
Why Use Context Clicks?
Automated tests often involve repeating the same action in different contexts. A context click allows the AI Test Engineer to:
- Reuse one command across multiple data sets.
- Easily switch which element is clicked by changing only the reference text.
- Reduce maintenance by avoiding multiple duplicate steps.
Example in practice
Imagine an e-commerce website where every product has its own Add to Cart button. Instead of recording a separate click for each product, you can record just one context click. The only thing that changes between runs is the product name defined as a parameter.
Examples:
Click on the cart button for a specific "<product>"
. The "<product>"
value can be changed to decide which product is added to the cart.
Adding a Context Click Step
To add a context click during recording:
Start recording and navigate to the relevant page.
Click the plus icon at the bottom-left corner to open the step type menu.
Select Add a context click command.
In the context selection box:
- Choose the reference text (this becomes the parameter).
- Click the element to interact with, relative to that reference.
Click Save to add the step.
Making Elements Dynamic
Sometimes both the reference text and the clickable target change across test cases. The AI Test Engineer can make values dynamic:
After choosing the reference and the element, check This is a dynamic value.
These values now appear in the Examples section, where they can be modified for each test run.
NOTE
This is helpful when both the context and action vary. For instance, an engineer might want to click “Edit” for one user and “Delete” for another.
Run Tests With Different Context Values
You can modify the context parameter value to click different elements in each run. For example, add multiple Example rows with different product names to dynamically click corresponding cart buttons.
NOTE
Don't forget to Generate Code and Save after finalizing all your steps.