0 Shares 1902 Views 8 Comments

Object Identification in TestComplete – Descriptive Way

Apr 09, 2013
1902 Views 8

Object Identification in TestComplete – Descriptive Way

object identification in testcompleteThe Object Identification in TestComplete is based on the properties and values of the object stored in Name Mapping. Sometimes, the properties and the value of the application objects gets changed at run-time, which results in failure of the object identification by TestComplete.To overcome this problem,we use descriptive approach for the identification of the object on Application Under Test (AUT).

TestComplete provides several methods for the same. Some of them are :

  • Find
  • FindAll
  • FindChild

Find method:

Find method is used to search the object in the desired hierarchy. Searching is based on the set of values of the specified properties.

Syntax

where

TestObj:Refers to an reference (object) from where the search for the desired object will begin

PropName:Set of unique properties of object for identification.

PropValue:Set of values of the properties used for object identification.

Depth:Refers to the level till what the TestComplete needs to drill down to find the object.

Refresh : It instructs TestComplete what to do if the object we are searching is not present in the TestComplete Object cache.This is an optional field.

Output : Object

For example we need to perform click operation on a web button whose text changes at run time.

Approach :

First we need to identify some properties which will uniquely identify the object on webpage.Here we chooses the class and text property of the button.After the identification of the properties we nee dto store all the properties and relevant values in two separate array.

Once we have defined the array,next we need to find the object for which we are searching

In this statement testObj refers to the reference node from where the search will began and search for the object who has the properties that of properties stored in VarA and values equal to values stored in VarB.And 10 tells TestComplete to search for the object till the 10th level of the reference node and not more than that and store the result in an object.

To determine whether the search was successful or not ,we can use Exists method on obj object .If the Exists method return false,it implies that search was unsuccessful else if it returns True,search was successful and we can perform the click operation

FindAll method:

FindAll method is used to search the object in the desired hierarchy i.e in both objects and child objects. Searching is based on the set of values of the specified properties.The output is in the form of the set of collection of the object which matches the criteria.

Syntax

where

TestObj:Refers to an reference (object) from where the search for the desired object will begin

PropName:Set of unique properties of object for identification.

PropValue:Set of values of the properties used for object identification.

Depth:Refers to the level till what the TestComplete needs to drill down to find the object.

Refresh : It instructs TestComplete what to do if the object we are searching is not present in the TestComplete Object cache.This is an optional field.

Output : An array consisting of all the objects of specified values of specified proprties.

For example we need to count the number of buttons on a page.

Approach :

First we need to identify some properties which will uniquely identify the object on webpage.Here we chooses the class property of the button.After the identification of the properties we need to store all the properties and relevant values in two separate array.

Once we have defined the array,next we need to find the object for which we are searching

In this statement testObj refers to the reference node from where the search will began and search for the object who has the properties that of properties stored in VarA and values equal to values stored in VarB.And 10 tells TestComplete to search for the object till the 10th level of the reference node and not more than that. and store the result in an array.

Once we get an array we can tell the no of button on the webpage as following:

FindChild method:

FindChild method is used to search the object in the desired hierarchy i.e  in the child object only. Searching is based on the set of values of the specified properties.

Syntax

where

TestObj:Refers to an reference (object) from where the search for the desired object will begin

PropName:Set of unique properties of object for identification.

PropValue:Set of values of the properties used for object identification.

Depth:Refers to the level till what the TestComplete needs to drill down to find the object.

Refresh : It instructs TestComplete what to do if the object we are searching is not present in the TestComplete Object cache.This is an optional field.

Output : Object

For example we need to perform click operation on a web button containing text as “Login” on a webpage

Approach :

As we know the web button is a child element of the page.So we can use FindChild method here.For that firstly, we need to identify some properties which will uniquely identify the object on webpage.Here we chooses the class and text property of the button.After the identification of the properties we need to store all the properties and relevant values in two separate array.

Once we have defined the array,next we need to find the object for which we are searching

In this statement testObj refers to the reference node from where the search will began and search for the object who has the properties that of properties stored in VarA and values equal to values stored in VarB.And 10 tells TestComplete to search for the object till the 10th level of the reference node and not more than that and store the result in an object.

To determine whether the search was successful or not ,we can use Exists method on obj object .If the Exists method return false,it implies that search was unsuccessful else if it returns True,search was successful and we can perform the click operation

So,these are the some other ways by which we can identify the dynamic objects in TestComplete.

Happy Learning!!!

You may be interested

Setting up Web Service Automation Project
Katalon Studio
240 views
Katalon Studio
240 views

Setting up Web Service Automation Project

Saket - Oct 24, 2017

Web services are specific services that can be published and called over the Internet by client applications. Katalon Studio supports functional testing of web services. This topic…

Setting up Mobile Automation Project in MacOS
Katalon Studio
241 views1
Katalon Studio
241 views1

Setting up Mobile Automation Project in MacOS

Saket - Oct 09, 2017

Using Katalon Studio, mobile tester can design automation test for both Android and iOS to run on physical devices, cloud services and emulators. This tutorial explains how…

UFT Jenkins Integration
Unified Functional Testing
795 views
Unified Functional Testing
795 views

UFT Jenkins Integration

Saket - Oct 03, 2017

In our earlier post, we got to know the easy integration of UFT with GIT. This post focuses on integration of UFT and Jenkins. I have also…

8 Comments

  1. Pingback: Most useful function in Test Complete - FindAllChildren - Automated360

  2. Hi

    Nice way to track down dynamic objects in TestComplete…..But if I use the Name Mapping Method and adding the ObjectType and IdStr property which do not change wouldn’t this be a better approach and make scripting easier….

    Regards,
    Savio Coelho

    Reply
  3. Yes, That is always a better approach to use Namemapping if the object’s property dont change. But I think we should prefer to go for Descriptive approach when it is not static, i.e. changing dynamically at runtime.

    Reply

Leave a Comment

Your email address will not be published.

Most from this category

Join The Growing Group of 15000+ Test Automation Engineers

Signup for our newsletter and get access to free downloads, as well as tips, tricks and techniques and various test automation resources.
Name
Email Address
Secure and Spam free...