Context Clicks
The Context Click command lets you click an element in relation to a nearby reference text. The reference text is parameterized, allowing you to dynamically change which element is clicked by modifying the reference value in the Examples section.
Context click on the cart button in the context of "<product>"
:
- Here, the
"<product>"
param value can be changed to parameterize which product gets added to the cart.
Add 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:
- First, select the reference text (this will be parameterized),
- Then, click the element you want to interact with in relation to the reference.
Click Save to add the context click step.
Make Both Elements Dynamic
After selecting both the reference text and the target element, click the checkbox labeled “This is a dynamic value.” This action parameterizes both elements, making their values dynamic.
You can then find these parameters in the Examples section of the recorder, allowing you to modify them for different test runs.
NOTE
This is useful when both the context and clickable target vary across test cases. For example, clicking different actions like “Edit” or “Delete” next to different users.
Customizing the Reference Parameter
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.