The Object Identification Center in LeanFT (UFT Developer ) is a tool that enables us to spy or view the test object properties as well as to create unique and robust identifications for application objects. The Object Identification Center ( OIC ) also creates the description object for us to directly use in the script. The Object Identification Center also generates code to use in automation scripts.
When the Object Identification Center is opened from an application model, it allows us to add test objects to the application model which is just like the UFT test object repository. To know more about the Application Model project please refer to Create LeanFT Application Model Project & Write First Test in Java.
Object identification center in LeanFT | UFT Developer
The OIC is set up for single object spy mode. However, we can also spy multiple objects in the test application by changing the OIC settings.
Prerequisites For Spying a Web-based application
Before you use the Object Identification Center (OIC), ensure the following things are done
- Make sure your LeanFT extension is added and enabled in the required browsers
- Open the browser after the LeanFT engine starts running.
- Open Object Identification Center (OIC)
Click on the LeanFT > Object Identification Center.
Spy Objects In The Test Application
By default, OIC identifies a single object at a time. Click on the Hat icon to start spying on the test object. Click on the required object in the application to capture it in the OIC. The OIC window appears, displaying the object properties in edit mode.
By default, the OIC automatically selects a set of recommended test object properties and values to uniquely identify objects. In the above snapshot, you can see only three properties have been selected to identify a text field. You can also select more properties if required or clear the unwanted properties. Click on the verify(✔) button to check whether selected properties are enough to identify the object. Upon clicking on the verify button it highlights the corresponding object in the test application. Once OIC is able to identify the object click on the Generate code to clipboard icon (</>) or press Alt+G. The code will be generated and copy to your clipboard. You can paste the generated code into your test script.
OIC generates code for the object and assigns it to a variable. You can perform the required operation can be performed on the variable. In the following code, the userNameEditField variable has been declared for an edit box, and later on, the same is used to set the value in the text box.
1 2 3 4 5 6 |
EditField userNameEditField = browser.describe(EditField.class, new EditFieldDescription.Builder() .name("userName") .tagName("INPUT") .type("text") .xpath("//TR[normalize-space()=\"User Name:\"]/TD[2]/INPUT[1]").build()); userNameEditField.setValue("Test234"); |
Note: When pasting generated identifications for a Web-based object, the browser parent object is called browser. If you using a different name for your browser test object, Please modify it in the pasted code. Likewise, you may have to replace the pasted parent identifications for Windows-based objects with previously defined variables for those objects.
Capture An Image of an Object
Recommended Posts
- How to Use Regular Expression in LeanFT | UFT Developer
- How to Send Keystrokes In LeanFT | UFT Developer
- Create Application Model Project in LeanFT | UFT Developer & Write First Test in Java
- Intuitive Way of MySQL Database Testing in Selenium | LeanFT
- Read and Write Excel File in Java Using Apache POI Lib