user7199123 user7199123 - 16 days ago 12
AngularJS Question

Object identification issues in UFT 12.5

I have an AUT (angular JS developed). I would like to know does uft have object recognition issues with objects in the development platform?

I have tried using DP approach, .set, fire event, replay time method and still it's not setting a value in my WebEdit field, by throwing the error message "object not identified/ one or more objects with same property"

My requirement is to enter a value in the WebEdit, then based on the value entered, corresponding options are displayed(not drop-down) and I need to select a value from the options.

This is my current code:

Dim current_Page
Set current_Page = Browser("Start").Page("Start")
current_Page.Sync
Dim oDesc
Set oDesc = Description.Create 'Create an empty description
oDesc("micClass").value = "WebEdit"
oDesc("type").value= "text"
oDesc("name").value= "locationSearch"
oDesc("html tag").value= "INPUT"
Wait 2
If current_Page.WebEdit(oDesc).Exist(1) Then
current_Page.WebEdit(oDesc).Highlight
current_Page.WebEdit(oDesc).Click
End if
current_Page.WebEdit(oDesc).set "06116"

Answer

You are facing issues with object identification because the properties you are using to identify your desired object matches more than one object on screen.

There is no right answer on which property you should use in order to properly identify your object, although there are some properties that have higher chance of being unique and therefore will help you.
The properties I usually take into consideration when mapping and identifying my objects are:

  • micClass - UFT recognizable class, such as WebEdit, WebElement, Link and so forth;
  • class - the html class, very helpful, depending on the case;
  • html id - that is a very good one, if your developer is a good guy and follows good coding practices; and
  • html tag- also very good to use.

But this is pretty much a question of Spying the properties of your objects and analyzing your Application to make sure you will face no duplicates.

One way of spying your object properties is to hit F12 in your browser and use the Developer toolkit from the browser.

Another way is to use the Object Spy from UFT.

In either way you should be able to identify which properties from your objects are unique. If you are mapping your object in Object Repository, you can also take advantage of the Visual reference identification settings to make sure you have the unique object identified, as I mentioned in my comments.
To do so, follow this steps:

  1. Open the Object Repository Manager;
  2. Select your mapped object;
  3. Click in [None. Click to Add] next to the Visual relation identifier settings on the right pane;
  4. Click on Preview button on the window that will open

This will highlight all objects on screen that match the properties you used to map your object and also will show to you how many objects you have in your AUT that share the same properties.
After that you can refine your object identification until you have only one object identified.

Another good way to use this resource (actually the main reason to use it) is when you simply cannot find the right properties to make your object unique to identify, because in here you can actually map another object that will always be displayed next to the object you want. In here you create a visual reference and UFT will be able to recognize your object. You can find a very good tutorial on how to use such resource in this link:
https://www.joecolantonio.com/2012/02/03/qtp-visual-relation-identifier/

And last, but not least, if you are in object repository manager, remember to Set the Smart Identification property as False, to make sure UFT is not identifying a different object than the one you are expecting.

I believe with this tips you have more chance on properly identifying your object.