Pre and Post Actions

An element action that can be performed before or after the main action.

Pre and Post actions are important aspects of any user experience and essential in any automated testing process. They allow us to prepare the element for a test before executing it and clean up after it is finished. QATTS has a rich set of actions for all the element types, which can be easily configurable.

Pre-Action can be used to set up the element for the test

Post-Action can be used to reset the element back to its original state / to activate the next element in automation.

How can i use these action

We can configure the actions in any UI Element in the properties section as below

action.pre : click

action.post : highlight

Multiple actions can be given in comma separated.

Automation

Action NameHow it worksWhen to use

click

Performs click operation on the element.

Many cases, this will help you. Few of them were : 1. When the textbox is not in active state is not blinking 2. When the pointer is not blinking in the textbox 3. When the text is not getting populated

waitforloader:YOUR_UI_ELEMENT

By default, this command takes the UI element which is configured in the Product. If not, the user can provide in the below way waitforloader:YOUR_UI_ELEMENT In general, waits for the loader to be invisible.

When a loader appears after clicking on a button When loader appears after populating something

clear

It clears the value from a textbox

By default, when populating a value into textbox it clears and sends the value. In special cases, when the value is not getting cleared and getting appended we can use this

highlight

Highlights the element with a red rectangular box

When the element action was getting performed and event was not getting triggered We can use this for debugging the element

escape

Performs the keyboard escape action on the element

When a date picker was getting populated, to collapse the picker pop-up we can use this

tab

Performs the keyboard tab action on the element

When in a form, to activate the next element we can use

left

Performs the keyboard left action on the element

Some times to append a value with certain index / To activate the pointer also we can use this

right

Performs the keyboard right action on the element

Some times to append a value with certain index / To activate the pointer also we can use this

up

Performs the keyboard up action on the element

Some times to append a value with certain index / To activate the pointer also we can use this

down

Performs the keyboard down action on the element

Some times to append a value with certain index / To activate the pointer also we can use this

pageup

Performs the keyboard pageup action on the element

When to capture the screenshot of the current / top view When in editor mode, to go to the starting point index

pagedown

Performs the keyboard pagedown action on the element

When to capture the screenshot of the current / bottom view When in editor mode, to go to the ending point index

backspace

Performs the keyboard backspace action on the element

To add a trailing and leading spaces in the text by default when populating a textbox

delete

Performs the keyboard delete action on the element

When working on a combo box to clear the old value we can use this.

focus

Makes the element as an active element in the current document

In general, It can be used when the textbox / any button is not in avtive state. To make the element active before performing the action. It can be used

movetoelement

It helps us to move the mouse cursor on to the web element and performs the cursor operation with offset(1,1)

It can be applied when the element is not in active state and becomes active whenever the mouse hovers only.

scrolltoelement

It scrolls to the element and make the element visible in the viewport. No matter how long we have to scroll

Any browser will have auto scroll feature when action was performed by default. If it doesn't work we can use this configuration in making the element visible in the view port.

dispatchevent

It frees up the element from all the events that were blocking the element for performing operations

When the particular element is having certain events, which were blocking to perform a click/populate actions we can use this in pre action

doubleclick

Performs the double click operation on the element

When the element has a customized functionality to perform double clicks

submit

Performs the enter operation on only forms which causes the current page to change

When working on a form to submit it after all the populations. In the final element we can use this in the POST action. Note : If the element is not in a form, we might get NoSuchElement exception

enter

Performs the keyboard enter operation on the element

When we are working on a chat window / forms this can be used in POST action which might cause the current page change.

sleep:YOUR_WAIT_TIME

This causes the current execution instance sleep for the given time

Not Recommended It is just an option to wait for something to complete or invisibilities.

Last updated