How UFT One uses smart identification - Use-case scenario

Relevant for: GUI tests and components

The following example walks you through the object identification process for an object:

Suppose you want to view the two products you added to the shopping cart, you have the following statement in your test:

Browser("Advantage Shopping").Page("Advantage Shopping").Link("ShoppingCart").Click

When you created your test, UFT One learned the following object description for the shopping cart:

Later, you may add another product to the shopping cart and want to display the total products in the cart again.

The default description for link objects (text, role, html tag, and acc_name) works for most links in the demo site, but it no longer works for the shopping cart now as you added another product and the shopping cart's text property no longer matches the description learned previously. Therefore, when you run your test, UFT One is unable to identify the link based on the learned description. However, using the Smart Identification mechanism, UFT One succeeds in identifying that link.

The following explanation describes the process that UFT One uses to find the shopping cart object using Smart Identification:

  1. According to the Smart Identification definition you have for Web link objects, UFT One learned the values of the following properties when it learned the shopping cart link:

  2. The learned values are as follows:

    Base Filter Properties:

    Property

    Value

    html tag

    A

    Optional Filter Properties:

    Property

    Value

    text

    2

    html id

    shoppingCartLink

    class

    img

    name

    2

    href

    http://www.advantageonlineshopping.com/#/shoppingCart

    visible True
    acc_name ShoppingCart

  3. UFT One begins the Smart Identification process by identifying several link objects that match the base filter properties definition (html tag = A). UFT One considers these to be the object candidates and begins checking the object candidates against the Optional Filter Properties list.

  4. UFT One checks the text property of each of the object candidates, but none have the text value: 2, so UFT One ignores this property and moves on to the next one.

  5. UFT One checks the html id property of each of the object candidates and filters out the other objects from the list. As the site only has one link object that matches the html id property, UFT One correctly concludes that it has found the shopping cart link and clicks it.