Identify dynamic UI Object
UI Objects are one of the most crucial parts of building a successful automation project. Some of them are static (do not change at all) and some of them are dynamic (they are dependent on some dynamically changing parameters).
Dynamic objects are a bit trickier to deal with than static objects, but it is not as difficult as it may look, there is an akaAT’s way to handle parameterized objects.
3.1.1. Apply data in Object’s variable
3.1.1.1. Apply data in Object's variable using loop
- Step 1: Enter variable name in “Variable” tab of UI Object
- Step 2: Write in locator to find element and put value variable into Locate Value through the character
$.this.varName
- Step 3: Create a test case and call the test object and pass the value to the set variable location
- Once an Object is called in the test case, the variable of Object displays in the “Variable” tab of the test case as shown in image below.
- You can input the value of the variable here or leave it blank and go to Step 4.
- Step 4: Create a data file and associate the dynamic XPath with the values in the table
- Step 5: Set Data source into a For Statement
- Step 6: Set value to Object variable in test case by Value in Data column (use syntax:
$.DATA.dataFileName.dataColumn
)
3.1.1.2. Apply data in Object's variable using index
We can call variables from test data in columns and rows if we want to use a row in test data. (use syntax: $.DATA.data1.[0][1]
)
3.1.2. Apply Global variable’s value in Object’s variable
- Step 1: Create Global Variable
- Step 2: In test case, set object variable’s value = Global variable value