Object Identification is the core of UFT One. You should understand it thoroughly before you try to work on any automation testing projects. In the earlier tutorial we discussed the complete object identification process in UFT. We discussed various stages of object identification namely Learned Description, Visual Relation Identifiers (VRI), Smart Identification and Ordinal Identifiers. In this tutorial, we will discuss the 3rd stage in detail – Smart Identification
What is Smart Identification?
If UFT is unable to identify any object that matches the learned object description, or if it finds more than one object that fits the description, then UFT ignores the learned description, and uses Visual Relation Identifiers (VRI) to identify an object uniquely. If VRI is not defined or VRI is not able to identify the object uniquely, UFT invokes the Smart Identification mechanism and try to identify the object.
While the Smart Identification mechanism is more complex, it is more flexible. Therefore, if configured logically, a Smart Identification definition can probably help UFT identify an object, if it is present, even when the learned description fails.
The Smart Identification mechanism uses two types of properties:
- Base Filter Properties—The most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object. For example, if a Web link’s tag was changed from
a
to any other value, you could no longer call it the same object. - Optional Filter Properties—Other properties that can help identify objects of a particular class. These properties are unlikely to change on a regular basis, but can be ignored if they are no longer applicable.
Understanding the Smart Identification Process
If UFT activates the Smart Identification mechanism during a run session (because it was unable to identify an object based on its learned description and VRI), it follows the following process to identify the object:
- UFT “forgets” the learned test object description and creates a new object candidate list containing the objects (within the object’s parent object) that match all of the properties defined in the Base Filter Properties list.
- UFT filters out any object in the object candidate list that does not match the first property listed in the Optional Filter Properties list. The remaining objects become the new object candidate list.
- UFT evaluates the new object candidate list:
- If the new object candidate list still has more than one object, UFT uses the new (smaller) object candidate list to repeat step 2 for the next optional filter property in the list.
- If the new object candidate list is empty, UFT ignores this optional filter property, returns to the previous object candidate list, and repeats step 2 for the next optional filter property in the list.
- If the object candidate list contains exactly one object, then UFT concludes that it has identified the object and performs the statement containing the object.
- UFT continues the process described in steps 2 and 3 until it either identifies one object, or runs out of optional filter properties to use.
If, after completing the Smart Identification elimination process, UFT still cannot identify the object, then there are two possibilities:
- If VRI IS defined: UFT pauses the run session and displays a Run Error message
- If VRI is NOT defined: UFT uses the learned description plus the ordinal identifier to identify the object.
If the combined learned description and ordinal identifier are not sufficient to identify the object, then UFT stops the run session and displays a Run Error message.
Reviewing Smart Identification Information in the Test Results
If the learned description and VRI does not enable UFT to identify a specified object in a step, and a Smart Identification definition is defined (and enabled) for the object, then UFT tries to identify the object using the Smart Identification mechanism.
If UFT successfully uses Smart Identification to find an object after no object matches the learned description, the Test Results receive a warning status ⚠ and indicate that the Smart Identification mechanism was used.
If the Smart Identification mechanism cannot successfully identify the object and VRI is not defined, UFT uses the learned description + the ordinal identifier to identify the object. If the object is still not identified, the test fails and a normal failed step is displayed in the results.
Walking Through a Smart Identification Example
The following example walks you through the object identification process for an object.
Suppose you have the following statement in your test:
Browser("LearnQTP").Page("LearnQTP").WebEdit("userName").Set "mercury"
When you created your test, UFT learned the following object description for the UserName edit box:
However, at some point after you created your test, a second UserName edit box was added to the bottom of the page, so the Web designer changed the original UserName edit box name tag to: userName1
The default description for edit box objects (type, name, html tag) works for most edit boxes in your site, but it no longer works for the UserName edit box, because that edit box name property no longer matches the learned description. Therefore, when you run your test, UFT is unable to identify the UserName edit box based on the learned description. However, UFT succeeds in identifying the UserName edit box using its Smart Identification definition.
The explanation below describes the process that UFT uses to find the UserName edit box object using Smart Identification:
1. According to the Smart Identification definition for WebEdit objects, UFT learned the values of the following properties when you recorded the click on the UserName edit box:
2. UFT begins the Smart Identification process by identifying the two objects on the web page that match the base filter properties definition (html tag = INPUT
and type = text
). UFT considers these to be the object candidates and begins checking the object candidates against the Optional Filter Properties list.
3. UFT checks the name property of each of the object candidates, but none have the name property value userName, so UFT ignores this property and moves on to the next one.
4. UFT checks the html id property of the two object candidates. Only one of them has the value loginbox, so UFT correctly concludes that it has found the first username edit box and enters the required value in it.
Step-by-Step Instructions for Configuring a Smart Identification Definition
You use the Smart Identification Properties dialog box, accessible from the Object Identification dialog box, to configure the Smart Identification definition for a test object class.
To configure Smart Identification properties:
1. Choose Tools > Object Identification. The Object Identification dialog box opens.
2. Select the appropriate environment in the Environment list on the top left. The test object classes associated with the selected environment are displayed in the Test object classes list.
The environments included in the Environment list are those that correspond to the loaded add-in in the Add-in Manager.
3. Select the test object class you want to configure.
4. Click the Configure button next to the Enable Smart Identification check box. The Configure button is enabled only when the Enable Smart Identification option is selected. The Smart Identification Properties dialog box opens:
5. In the Base Filter Properties list, click Add/Remove. The Add/Remove Properties dialog box for base filter properties opens.
6. Select the properties you want to include in the Base Filter Properties list and/or clear the properties you want to remove from the list.
Note: You CANNOT include the same property in both the base and optional property lists.
For all environments except Web, you can specify a new property by clicking New and specifying a valid property name in the displayed dialog box.
For web objects, you can add property names to the set of available properties using the attribute/<PropertyName>
notation. To do this, click New. The New Property dialog box opens. Enter a valid property in the format attribute/<PropertyName>
and click OK. The new property is added to the Base Filter Properties list. For example, to add a property called MyColor
, enter attribute/MyColor
.
7. Click OK to close the Add/Remove Properties dialog box. The updated set of base filter properties is displayed in the Base Filter Properties list.
8. In the Optional Filter Properties list, click Add/Remove. The Add/Remove Properties dialog box for optional filter properties opens.
9. Select the properties you want to include in the Optional Filter Properties list and/or clear the properties you want to remove from the list.
Note: You cannot include the same property in both the base and optional property lists.
For all environments except Web, you can specify a new property by clicking New and specifying a valid property name in the displayed dialog box.
For web objects, you can add property names to the set of available properties using the attribute/<PropertyName>
notation. To do this, click New. The New Property dialog box opens. Enter a valid property in the format attribute/<PropertyName>
and click OK. The new property is added to the Base Filter Properties list. For example, to add a property called MyColor
, enter attribute/MyColor
.
10. Click OK to close the Add/Remove Properties dialog box. The properties are displayed in the Optional Filter Properties list.
11. Use the up ⇧ and down ⇩ arrows to set your preferred order for the optional filter properties. When UFT uses the Smart Identification mechanism, it checks the remaining object candidates against the optional properties one-by-one according to the order you set in the Optional Filter Properties list until it filters the object candidates down to one object.
That’s all about Smart Identification in UFT (QTP). In the next tutorial we will learn in detail about Visual Relation Identifier.
If you have any questions around Smart Identification, please comment below. You can refer earlier tutorials in the series at this link UFT Tutorials.
If you have not already done so, make sure you enter your name and address below to receive the next tutorial as soon as it is ready.
In case you are starting out with UFT and want an overview, check this article on What is UFT?
Is the object in QTP is identified based on the applciation URL.
i.e., if the applciation is environment is changed , say to a different network, will that have an impact on my recorded scripts and objects in repositories?
Please reply.
Thanks in Advance
KNV
@knv: They are identified based on object properties etc.
Hi,
I’m new to Descritptive programming and also QTP.
I’m looking to decode a code
one of by colic has written a code is calling a function findByLabel(strLabel). So what would be the value of obj would be here .The code works but trying to understand code.I Tried to add it to watch list but it says values is or else did he maintain a default value for obj if so where would have it been maintained??
but the function in here is like this
Function findByLabel(obj, strLabel)
Set findByLabel=findByLabelIndex(obj, strLabel, 0)
End Function
'@Description Locate a webedit based on the text value of a label
Function findByLabelIndex(obj, strLabel, index)
Dim labelDesc
Dim labels
Dim Label
Dim attrs
Dim attr
Dim htmlidFound
Dim htmlid
Dim editDesc
Dim edits
' do some verification on the object
obj.getROProperty("name")
@Madhu: Our comments section is generally limited to any discussions related to post above. Please ask related questions on UFT forums
Hi Ankur,
My application is developed in .net.QTP is not able to indentify the sub nodes. It can indentify the nodes.
Thanks in advance
-Anand
Hi Ankur,
How can I trace that which part of the project need automation?
Thanks
Manish Ranjan
Hi Ankur,
Can you please let me know how to make QTP work with Calypso trading tool?
Regards,
Pinakin
@Pinakin: We would need to check the tech behind UI of this app. Please ask follow up questions on QTP forums
Hi Pinakin
QTP identifies calypso objects. No extra add-ins are needed.Just try and record and play.You should be able to identify.Just make sure that the java add-in is seleted from the list of default add-ins
Hi Uma,
Open QTP then open app
CTRl+R
Click on + symbol click on any object
HOw to select the object in winobject
QTP is identifying has a winobject in this object i need to seleect the One object in drop down
Thanks in advance
Awesome one
My question was How objects are added to the OR…but you explained how object finds and more in detail smart identification.
i have one doubt, can anyone clarify my doubt.
what is the unique property to identify the objects in QTP
Hi Ankur
I am using QTP 9.2 having problems with web addins
When i add the object in Object repository with Title as mandatory property for Browser and Page
QTP CODE,
browser(“Browser”).Page(“Welcome to-“).WebEdit(“email”).set
Browser object using class name as unique property instead of Title.
This is creating lot of problems with i merge the objects
Please help
Hi Ankur
Thanks you for your help over the years with your QTP forum. It has really help me in the past. I did not go through the entire forum to see if you had any specific response on Silverlight 4.0 using QTP 10.0. I have all the patches installed but I am having some difficulty identifying objects in the Silverlight application. Are there any tricks that you can share. Thank you in advance
Hi Ankur,
While recording the application a new window is opened to register the new user details. But have observed that QTP is not recognising those objects in the new window.
I am new to this tool.
Can u please help me here
Thanks
Ankur,
I would like to get your thoughts on how to use QTP to click on the custom button in Outlook. Developer has added one custom button in outlook and I have to select one of the email and have to click on that button so it will open another dialog box. QTP is able to identify the pop up box but not the custom button so do you have any idea how we can get the custom button clicked via qtp.
hi to all..will u pls give some suggestions to how to face interviews on qtp.
Hi,
I’m working with a .net application, I want to use the recording feature to record the objects in the application. Now, when I use recording, it works based on the co-ordinates of the object, which makes it highly prone to failure.
For example, a click is recorded as:
SwfWindow(“GEARS”).SwfObject(“_Main_Toolbars_Dock_Area_Top”).Click 20,10
So, my question is-
How can I make these actions independent of co-ordinates?
Hi any one help me to solve the below issue.
1)i want to select row in WebTable
2)But the web table having >3000 rows
3)i used GetRowWithCellText method to find the row which needed
4) But the visibilty of webtables only for 40 rows. if i click the down arrow in webtable it showing 41 row
5) i want to click the 200th row
pls help me to solve this problem
Excellent article!
Keep up the good work.
Hello Ankur,
Yours tips and posts on QTP are very helpful. Currently, I am having a issue with working on QTP on an application that uses citrix frames. It’s basically a java app that’s initiated from the browser via citrix. I have to QTP on a virtual server and when ever, I try to record the actions on the app, all I get is the initial login and password screen. All the rest doesn’t get captured. And if I try using the object spy, I find the properties for all the buttons existing are ‘remote’ and nothing much. Please let me know how to handle this in identifying the objects from the app. Your help is greatly appreciated.
Thanks,
Sri
SSTreeWndClass support in QTP
Hi,
I need to click on a node in a tree which belongs to SSTreeWndClass.
I am doing this in QTP 10 Build 513.
Window(“Application Logic Simulator”).Window(“Input Status Display”).WinTree (“SSTreeWndClass”).Click 21, 31
1) When I run QTP for above code, it says Object not supported.
2) Here, the co-ordinates are hardcoded. How to make it click on node by identifying it? It has child nodes also. Need to click on it also.
Can anybody help me in making it work?
Regards,
Anant
Dear Ankur Jain
My name is Gopal. I am from Australia/ Canberra
I am currently working in Medicare Australia,
I have mainframe systems and I would like to record QTP Scripts for the mainframe (COBOL) and test the values that are displayed in the screen
with regards to that I would like to know
1) how to install the Emulator Addin for QTP ( for mainframe )
2) after installing how to record the mainframe screen ?
3) how to get the values into variables [ using getroproperty(“innertext”) ]
4 ) How to insert keyboard commands ( Ex. F5 or F2 or a simple Enter )
5) and how to insert values from the Datatable into the mainframe ?
If you can show us in youtube videos that would be very very helpful ( if I am not troubling you very much )
hope you can transfer your knowledge
please send me a link to
pgopal1980@gmail.com
When you post the answers
Thanks heaps
Hi,
I have recorded some test cases scripts using QTP, now I want to run the same on other pc also in which QTP is not installed, plz let me know how can I do that? it has some simple operations like opening outlook, notepad etc and performing some operations on it. Can I save those scripts in notepad as .vbs file and then use it in any other pc? plz guide me how can I do that..Thnx
-Kanisha
kanisha1906@gmail.com
Hi i have 2 question and don know the reason for that. please help me to come over it.
1) While running QTP script suddenly throwing the run time error as “Cannot find the “[Web Edit]” object’s parent “[Page]” (class Page). Verify that parent properties match an object currently displayed in your application.” I tried with object spy to view the properties of a particular object. It showing like:
“Browser: This page is intentionally left blank
Page: This page is intentionally left blank.”
How to solve this problem?
2) If I make some changes in my script, QTP fails to run and throwing the run time error which is mentioned above.
Its urgent plz help me.
Thank you in advance.
Preetha.
while recording the application i had selected the radio button in the particular page.but in that Page there are four radio buttons.while running the script i am getting the Error “Cannot identify the object”radiobutton name”(of class webRadioGroup)
Hi Ankur,
Is there any option avaailable(customizing/coding) to skip a few steps within a test with status not completed and update those manually later?
vishal
I have QTP 10, Windows Vista and MS IE browser.
The Object Spy and “Navigate and learn” do not recognize objects on the Mercury Tours homepage.
Kindly help.
Hi Ankur
I need one clarification on Ordinal identifier. My question is,
Qtp can exactly identify the object by using ordinal identifier. then why it is using mandatory and assistive properties to identify
the objects otherwise it can directly uses the ordinal identifier right?
Does QTP support to Share point applications?
hi ,
this is the best knowledge base i have seen regarding QTP. I would definitely recommend to all those qtp knowledge seekers.
Gr8 job Yaar!!!
Hi,
I am new to QTP 10. I test configuration application on IE8. It dynamically creates and populates objects on the webpage using javascript. The objects are list with checkboxes,radio buttons, dropdown, textboxes. The QTP object spy recognizes these as WinObject.
Does QTP have a feature or add-in that recognizes these objects created using javascript?
Thanks in advance for all your help.
HI Ankur,
This is an awesome blogspot for QTp.Am a great fan of urs.The informatio provided by you is really very informative.I really appreciate your effort and for giving such a scope for learners.
Thank you sir…
Hi very good article.i have one doubt regarding this. what is the heirarchy of the object identification.
Ex: Check property in Mandatory& assistive first –> ordinal identifier –> next goes to smart identification basefilter/optional
is this right pls tell me..
— Mohan
Hi,
I’m new to QTP, just installed QTP 10 trial on Windows 7 and IE 8. I tried to use Object Spy to capture Test objects on Mercury Tours login page but it records Object as Nmae: Windows Internet Explorer and Edit, Edit_2, Edit_3. It does not record Mercury Tours as browser name and WebEdit:userName. I have web add-in. Could you please clarify.
Thanks
Hi Ankur,
When u save QTP test i will be saved in folder form, ok…
Please open the saved test folder, now you will see a folder named Action(0), wt is this action(0)…Wts the use of it…
Action(0) in all the test tht u have save, please brief me about it…
Hi Ankur,
When u save QTP test i will be saved in folder form, ok…
Please open the saved test folder, now you will see a folder named Action(0), wt is this action(0)…Wts the use of it…
Action(0) in all the test tht u have save, please brief me about it…
Hi Ankur,
I have a question,
When my browser objects are redesigned( moved the object in to new position, Added new objects on screen etc). Then should I change the script written for that page totally? How to handle this situation in an easy way with out affecting entire script.
When new features are added in every new release of a project, How to handle QTP script?
@Suresh: I have answered your question here
Hi,
I am recording using QTP and for some reason QTP does not recognize any upload buttons. For example, start the recording at this site: http://cgi-lib.berkeley.edu/ex/fup.html
Click on the “Browse” button
Notice this click is not recognized by QTP. Please provide some feedback why QTP is not able to recognize this button. Thanks.
Hi Ankur,
I am working on a PowerBuilder application. While using Object Spy on the data-window, QTP does not recognise the objects within the data-window. The parent data-window contains few text boxes, chk boxes and drop down lists. Please suggest some method to identify those objects.
Thanks,
Nintu
Hi Ankur,
A lot of Thnx….
am currently trying to run QTP scripts which were recorded on a PC- PC1, on one of my PCs- PC2 and the script continually fails at points where it does not find objects in the repository. I am forced to re-record time and again to solve this problem.
Right now, I am doing this step where I’m logged into Outlook and am trying to select File –> Open.
I get the following error for the Context Menu object
“
The “ContextMenu” object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.
Line (36): “Window(“Outlook Express”).WinObject(“Outlook Express Message_2”).WinMenu(“ContextMenu”).Select “Open Ctrl+O””.
”
How do we avoid this problem while porting between PCs?
Hello,
QTP can’t recognize outlook. Inorder to make QTP identify your outlook object, you need to install Outlook spy ( as object spy). You even need have knowledge of API’s (MAPI’s)provided by microsoft to work with outlook.
Hello,
I do not understand why when the Smart Identification mechanism cannot successfully identify the object, QuickTest uses the learned description plus the ordinal identifier to identify the object. Before using Smart Identification mechanism, we already used the learned description method that did not successfully identify the object.
Thank you to make this point clear.
Hi ,
I am trying to automate a progress based application(windows based ).In one screen, I have nmore than one edit field, contxt recording is not working…DP is also not successful..QTP is unable to identify the attached text property related to the edit fields..so its not unable to recognize..Can anyone tell me..what to do next…I tried analog recording..it works but If I close QTP and open it gain,the same script fails…I have tried low level recording.that also fails….please suggest me..
Hi,
I like this QTP blog site. How can I post the questions? I’m new to QTP. I just started a .net project. I’m able to open the application automatically and recored some steps. But when I’m running the test, application is opening and rest of the steps are not running at all. is any body can help me?
Regards
Ram.
Hi Ankur/fellow testers,
I am currently trying to run QTP scripts which were recorded on a PC- PC1, on one of my PCs- PC2 and the script continually fails at points where it does not find objects in the repository. I am forced to re-record time and again to solve this problem.
Right now, I am doing this step where I’m logged into Outlook and am trying to select File –> Open.
I get the following error for the Context Menu object
“
The “ContextMenu” object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.
Line (36): “Window(“Outlook Express”).WinObject(“Outlook Express Message_2”).WinMenu(“ContextMenu”).Select “Open Ctrl+O””.
”
How do we avoid this problem while porting between PCs? One of the approaches I tried was to export the objects in PC1 and save it as a .tsr file which i copied into the other pc, PC2. In PC2, I tried to import this tsr file by pasting the following bit of code in my qtp script:
Dim App ‘As Application
Set App = CreateObject(“QuickTest.Application”)
App.Test.Settings.Resources.ObjectRepositoryPath =”c:act.tsr”
However, this failed with the error:
You cannot change the object repository type for this test.
Line (3): “App.Test.Settings.Resources.ObjectRepositoryPath =”c:act.tsr””.
Any idea? We are wasting a lot of time having to re-record/add objects which are not recognized.
Appreciate any help.
Thanks so much.
Hi Ankur,
I have lots of ambiguities on SI usage and advantages ..finally got all the answers to this feature …
great work….I must appreciate yor approach to explain in detail…
Malleswari.
Hi Ankur,
I worked on above specified scenario and had a doubt. The doubt is
1. I disabled smart identification for webimage in Object identification window, recored the script and saved the object repository.
2.I reopend the qtp and loaded the OR and recorded script. At this time I was tried to enable the smart identification for webimage in Object identification window. But in OR window, for webimage objects, Smart identification option was in disable state only.
In this situation, How could I enable SI for webimange?
@ Meads:
If you are using QTP 6.5 or above version you can generate .vbs file on Object identification setting tab and use this vbs file for the particular script only
@RoopaDilip: I can simply say that either automate upto the point where automation is feasible or ignore those scripts(for automation) where manual intervention is required.
@ Anon(2): Yes you can do that…Whats the problem?
Hi, In the OR, I need to map an object that is a link to an external website and have the test verify the URL is the same as expected. Can I include the destination URL as part of the object, i.e. not the current session URL.
Thanks
Hi Ankur,
You are doing great job here
thanks for ur help
I am new for QTP
iam able to recording but unable to playback the script, some edit fields giving problems i dont know exactly what is the problem i did object repository but same problem repeating
If anybody know give me suggestions
Thanks
Hi,
I am a newbie in QTP please help me by answering my query.
I have a testcase wherein I can automate testing of few actions and few actions requires manual testing.
How can I integrate both maunal and automation testing for a given test case?
Hi,
I have a question about how the object identification settings are stored and recorded.
When I create a new test and record with particular Object ID settings is it possible to save the settings just for a particular test?
The reason for this is that I have VbComboBox which is getting found unless only the “vbName” is selected and nothing else
Thanks
Meads
@Deepika: You raised a nice point, I would say that this para When QuickTest uses the learned description to identify an object, it searches for an object that matches all of the property values in the description. In most cases, this description is the simplest way to identify the object, and, unless the main properties of the object change, this method will work. sums it all. In interviews, I see most people goof up on the area of Smart-Identification.
But yes I do acknowledge, I have not written explicitly about mandatory and assistive properties.
Hi Ankur,
Don’t you think you missed an important refernce to manadatory & assistive properties before smart identification method is invoked in your writeup of ‘How QTP identifies object’?
Hi Shiva,
Simply un-check the property created by you.I dont think you would be able to “delete” the property. If you do, please let me also know about that 🙂
Regards,
Ankur
Hi Ankur,
I added a new property in the “Base Filter Properties” by clicking on the “New” button. But I am not able to delete that property. Can you tell me how I can delete the new property that I created?