Action Keyword for Web
A test case is a set of conditions that determine whether an application or one of its modules is functioning properly. You can write multiple test cases in a single module. Test cases are executed in alphabetically ascending order of their names.
Actions
These are the actions we use to write our test cases. The following are the definitions and a few examples of when each action would be used.
1. Wait For :
- This action keyword is used to wait for a certain amount of time(In seconds) till the webpage or the elements of the page load completely. Generally used when a website takes a longer time to load.
-
“Is Visible” condition to be checked whether the element is visible or not.
-
“Is Invisible” condition to be checked whether the element is Invisible or not.
- “Is On” condition to be checked where the element is UI like toggle button on or off.
-
“Is Off” condition to be checked where the element is UI like toggle button on or off.
-
Is Equal To” condition to be checked where the element condition value matches the aspected or received value.
-
“Is Not Equal To” condition to be checked where the element condition value does not match the aspected or received value.
-
“Is Greater Then Or Equal To” condition to be checked where element condition is logically given accordingly value.
-
“Is Less Than Or Equal To” condition to be checked where element condition is logically given accordingly value.
-
“Is Greater Than” condition to be checked where element condition is logically given accordingly value.
-
“Is Less Than” condition to be checked where element condition is logically given accordingly value.
-
“Contains” condition to be checked where element text contains some character, digit, etc. given accordingly value.
- “Is Enable” condition to be checked where elements are enabled, like UI buttons, toggles, etc
-
“Is Disable” condition to be checked where elements are enabled, like UI buttons, toggles, etc.
2. Tap on :
- This action keyword is used to click on any element on a web page; it contains three arguments, and a number of taps, which indicates how many times the user wishes to click on that element. The other is the amount of multi-touch points, which signifies that the user can use the multi-touch functionality (which is primarily used for mobile elements).
-
For the Number of Tap
3. Type in :
- This action keyword is used to pass text in element fields such as username, password, and so on. It has a true/false argument that enables/disables the keyboard.
4. Check :
- We can specify assertions using the Check action. It can “Check” if a specified condition is true. The check action will also “Check” the value of any element.
- “Is Visible” This assertion condition is checked when an element is visible or not.
-
“Is Invisible” This assertion condition is checked when an element is visible or not.
-
“Is On” This assertion condition is checked when an element is UI like a toggle button on or off.
-
“Is Off” This assertion condition is checked when an element is UI like a toggle button on or off.
-
“Is Selected“ This assertion condition is checked when an element is UI like a checkbox or dropdown value is selected or not.
-
“Is Equal To” This assertion condition is checked when an element value equal to the condition is logically given accordingly value.
-
“Is Not Equal To” This assertion condition is checked when an element value not equal to the condition is logically given accordingly value.
-
“Is Greater Than Or Equal To” This assertion condition is checked when an element value to greater equal to condition is logically given accordingly value.
-
“Is Less Than Or Equal To” This assertion condition is checked when an element value to less equal to the condition is logically given accordingly value.
-
“Contains” This assertion condition is checked when an element value to contains is logically given accordingly value or not like characters, digits, etc.
-
“Contains Alert Type” This assertion condition is checked when an element values on the Alert popup contains are logically given accordingly value or not like characters, digits, etc.
-
“Is Enable” This assertion condition is checked when an element is enabled, like UI buttons, toggles, etc
-
“Is Disable” This assertion condition is checked when an element is enabled, like UI buttons, toggles, etc.
- “Is Approximately” This action keyword is used to assert/check the approx. the value.
5. Scroll to:
-
This action is used to scroll the screen until the element is in the visible part of the screen. accordingly, action as we use for UP, DOWN, LEFT, & RIGHT.
For Multiple layout elements to be used parents and child elements form the below example.
6. Swipe :
-
This action is used to perform a directional swipe gesture. We can specify any of the four directions, and the swipe (up, down, left, and right) will happen in the middle of the screen. We can also specify the container that we wish to swipe into. Also able to swipe on interaction in particular elements.
7. Variable:
-
This Action is used to declare a variable. We can also specify its datatype (String, integer, or JSON)
- Using this URL, you can convert CSV to JSON: https://{_YOUR_DOMAIN_}.testgrid.io/csv-to-json.
8. Save to Variable :
-
This action is used to assign value to the already declared variable.
9. Repeat If, End Repeat :
- This action performs a repetitive action based on the condition set by the user.
10. Comment :
-
This action does not affect the test case running. Commenting is used as a way to make notes for the user.
11. Call Test Functions :
-
This action is called a declared test function.
12. Call Network Assert :
-
This action calls the network assert test case inside the UI test case.
13. Clear Network Log :
- This action ignores the network calls that were made before this step in the network assert test case.
14. Print Log :
-
This action will print the parameter you give it in the detailed log (i.e.: Typing “Hello World” will print “Hello World” in the detailed logs)
15. Increase :
-
This action increases the value of an integer variable.
16. Select :
-
This action is used to select text from a single-element or multiple-element list with text and index.
17. Switch to iFrame :
- This action is used to switch to iFrame on the web with the using frame ID and index.
18. Switch to Parent Frame :
- This action is used to switch to Parent iFrame on the web.
19. Switch to Default Content :
- This action is used to switch to Default Content on the web.
20. Switch to Tab :
- This action is used to switch a tab on the browser.
21. Open New Tab :
- This action is used to open a new blank tab on the browser.
22. Right Click :
- This action is used to perform a mouse right-click on the element.
23. Double Click :
- This action is used to perform a mouse double-click on the element.
24. Click and Hold :
- This action is used to perform click and hold action on an element.
25. Type Encrypted :
-
This action is used to type text in the text fields in encrypted format. The auto-hide keyboard feature can be set to true or false.
-
Use the link below to convert your password or sensitive access data to an encrypted format for use with TC.
- Example : https://{_YOUR_DOMAIN_}.testgrid.io/hide-me
26. Hover :
-
This action is used to hover an element.
27. Write to CSV File :
-
This action is used to write text in CSV. You can use select action or element or the text.
28. Declare :
-
This action is used to declare elements while writing test cases.
29. Take Full Screenshot :
-
This action allows you to take a full screenshot.
30. Press Key :
- This action allows you to use the keyboard keys to press.
31. Control+Click:
- This action keyword is used in the test case to fulfill a specific application of the control+ and click keys from the keyboard.
32. Test Functions :
-
Test Function is a set of commands that performs a specific action. You can create a Test Function for any repetitive actions.
-
Click on “Add Test Function” button.
-
-
If you have the same scenario in many test cases then you can create one function for that and use it in every test case.
-
Add a Test Function Name and Description.
-
Add steps.
-
Click on the Update button.
-
33. Use Test Function In TestCase :
-
-
Open your test case.
-
Select the Call Test Function.
-
Now, you can see your test functions in the right field and select the function from the drop-down list
-
-
As simple as that! Happy Testing