0 Shares 1397 Views 8 Comments

Object Identification in TestComplete – Descriptive Way

Apr 09, 2013
1397 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 Mobile Automation Project in Windows
Katalon Studio
77 views
Katalon Studio
77 views

Setting up Mobile Automation Project in Windows

Saket - Sep 20, 2017

This tutorial explains how to setup a mobile automation project and test a mobile app using Katalon Studio on Windows. This tutorial assumes that you are familiar…

Katalon Studio GUI Overview
Katalon Studio
147 views2
Katalon Studio
147 views2

Katalon Studio GUI Overview

Saket - Sep 14, 2017

GUI Overview After installing and setting up Katalon Studio for your automated test, you must understand the GUI. In this post we will walk you through the…

LeanFT Tutorial #4: Application Model Overview
LeanFT
125 views1
LeanFT
125 views1

LeanFT Tutorial #4: Application Model Overview

Saket - Sep 10, 2017

In this post we are going to focus on Application Model in LeanFT. Refer our earlier posts on LeanFT Getting Ready with LeanFT Browser Extensions and Settings…

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...