Document toolboxDocument toolbox

Locator Priority Settings

Locator Types

The Object Spy has the following locator types:

  • Link
  • Name
  • ID
  • XPath
  • CSS

This is the default sequence. You may change the sequence as per your requirements. 

Locator Priority Settings

The built-in algorithm helps to choose best suitable locator type while finding the best suitable locator to HTML element being inspected.

(warning) Qualitia does not use ID attribute when inspecting objects by XPath.

To change the locator priorities:

  1. On Object Spy toolbar, click the Settings icon.
    The Locator Priority Settings window appears.
    1. Click Up/Down buttons to changes the priorities of the locator type.
    2. Click Restore Default to restore the default priorities.
    3. Click Cancel to discard changes.
    4. Click Ok to apply the changes.

Object Learning Algorithm

Based on the preferred locator types, Object Spy looks for name property of the desired object. If it is not found it looks for the next preferred locator type which is for example ID. If it is not found, it then derives Xpath by referring to other native properties of the object or even of a parent if required. This is typically required in a case of duplicate objects. For more information on duplicate objects refer to the /wiki/spaces/QASWM/pages/407404959 section.

When Object Spy overrides the preferred locator type even if the object has Name or ID Attributes

Assume you have set preference of locator type as Name, ID, Xpath, and Link. The object which you want to add has name property. Object Spy reads the value of name property and checks whether there is another object that has same value of the name property. If a duplicate is found then Object Spy overrides preference and looks for ID or Xpath.

Once Object Spy is sure about the locator type and value being unique for the object, the object will get added. You can further edit the logical name of the object and rename it.

Once the objects are added and saved from Object Spy, you can select objects from the object drop-down without any need to refresh or relaunch Qualitia.

Objects under Frame

This is a typical method that Selenium operates with objects. Selenium searches the object within the scope of the HTML page. Frame element also can hold 'HTML' tag enclosed within. If Selenium is supposed to act on any object under frame, it has to first decide the scope of searching the object in the HTML within the frame and not outside HTML. This is typically done by selecting a frame during development of a test case. 

Object Identification Failure

Object identification failure can be categorized by the following cases:

  • Object does not exist

Object identification failure may occur due to network latency. This may happen when designated page is heavy to load in expected time or connectivity failure. This can be handled by changing synchronization time.

  • Object exists but tool failed to identify

A tool may fail to identify an object when object identification is based on incorrect attributes. Selected attributes might not have a static value. At times, there are properties, which are supposed to be static but contain dynamic values.

For example, ID attribute is supposed to be static but there are frameworks that generate values of ID attribute dynamically. In such cases, your ID values are supposed to change every time you refresh a page. On the other hand, there can be situation where a window is identified by title. If title contains time stamp as a part of the title, it is prone to change repeatedly after each login. In all such cases, it is advisable to look for another property that is static and uniquely points to the desired object. If there is none and you have to deal with dynamism of the attribute value, check whether the dynamic portion of attribute value is predictable or not.

For example, when user1 logs in, the Login window has a title 'welcome user1'. If you change the login credential to user2, welcome will remain the same and the dynamic portion 'user2' is predictable that is 'welcome user2'.

Dynamic portion in this case is the same as the user credential used. The same user credential can be passed as part of attribute value.

If dynamic portion is not predictable, then the common practice is using regular expression to get rid of the dynamic portion. In the same example of login title, title property can hold a regular expression as 'welcome.*'. You can ignore the dynamic portion and rely on static portion if it uniquely points to the desired object.