Document toolboxDocument toolbox

Header

Introduction to ObjectSpy

Object Spy is a tool that learns the objects in your web application and stores them in the repository. These objects are foundational elements of an automation script. Qualitia  provides two ways of learning objects: through the Qualitia  recorder and the Object Spy.

Browser Specific ObjectSpy: Qualitia  provides three extensions for three widely used web browsers:

  1. Chrome Object Spy

  2. Edge Object Spy

  3. Internet Explorer Object Spy.

However, the Internet Explorer Object Spy will soon be deprecated.

Object Learning Algorithm

As an Automation Tester, it's important to understand the Object Learning Algorithm. This tool is beneficial in locating desired objects based on preferred locator types. For instance, the algorithm first attempts to find the 'name' property of the desired object. If it doesn't locate the 'name', it proceeds to the next preferred locator type, which could be 'ID'. If 'ID' isn't found, the algorithm determines the 'Xpath' by referencing other innate properties of the object, or even its parent when necessary. This process becomes essential in cases of duplicate objects. For more information on this topic, you should refer to the Rules for Duplicate Objects section.

There could be a situation when the Object Learning Algorithm overrides the preferred locator type, even if the object contains Name or ID Attributes. Let's assume you've set the locator type preference as Name, ID, Xpath, and Link. You're trying to add an object that has a 'name' property. The algorithm reads the value of the 'name' property and checks if there's another object with the same 'name' value. If a duplicate is found, it overrides the preference and looks for 'ID' or 'Xpath'.

Once the Object Learning Algorithm has identified a unique locator type and value for the object, you can add the object. There's also the option to edit the logical name of the object and rename it as per your needs.

After you've added and saved objects from the Object Learning Algorithm, you can select them from the object drop-down menu in Qualitia without needing to refresh or relaunch the tool.

Objects under Frame

Understanding 'Objects under Frame' is also crucial for an Automation Tester. This is a typical way Selenium operates with objects. Selenium searches for the object within the scope of the HTML page. An 'HTML' tag can also enclose a 'Frame' element. If Selenium has to act on an object under a frame, it first needs to determine the scope of the search within the HTML inside the frame, rather than outside the HTML. You generally do this by selecting a frame during test case development.

Object Identification Failure

There could also be cases of Object Identification Failure. This can happen if the object doesn't exist or due to network latency when the designated page takes too long to load or if there's a connectivity failure. You can manage this by adjusting the synchronization time.

At times, the tool may fail to identify an object when its identification is based on incorrect attributes. For example, selected attributes might not have a static value. In such cases, the values of attributes like 'ID' might change every time you refresh a page. Or there might be cases where a window is identified by title, and the title changes repeatedly after each login due to a timestamp.

To handle these, it's advisable to look for another property that is static and uniquely points to the desired object. If there is none, check whether the dynamic portion of attribute value is predictable.

Let's consider a more tangible example. Imagine you're testing a music application that has a unique greeting for each artist on their individual page. When you visit the page of the artist "Beatles", the page title reads "Welcome, Beatles fans!". If you navigate to the page of "Rolling Stones", the title changes to "Welcome, Rolling Stones fans!". In both cases, the static portion of the title is "Welcome,", and the dynamic part is the artist's name followed by " fans!". The dynamic part is predictable because it corresponds to the artist's name.

However, if the dynamic portion of the title is unpredictable, then you need to handle it differently. For instance, let's say the artist page has a unique random number attached to it each time you visit. The title might read "Welcome, Beatles fans! Your number is 123456". The number changes unpredictably each time you refresh the page. In such cases, you can use a regular expression to exclude the dynamic part of the title. The title property could be given a regular expression like "Welcome, Beatles fans!.*", allowing you to disregard the unpredictable dynamic portion (the random number) and depend solely on the static part ("Welcome, Beatles fans!") that uniquely identifies the artist's page.

As an Automation Tester, you should be well-versed in using Qualitia, which provides the facility to select appropriate modes and APIs based on the application type while adding objects via the object spy. This flexibility is vital for effective testing, and these are the scenarios where they can be particularly helpful:

Capture Mode

Qualitia offers two modes for capturing objects to be used in tasks and test cases:

Left Click: In this mode, you can add objects to the repository by simply left-clicking with your mouse. This mode is useful when you have a static web page where elements don't change or move when interacted with.

Mouse Hover: In this mode, you can add objects to the repository merely by hovering your mouse pointer over the objects. This mode is handy when dealing with elements that are revealed on hover, like dropdown menus or tooltips.

Capture APIs

Qualitia primarily provides two APIs for capturing objects:

To select a Capture mode:

  1. Start the Object Spy.

  2. Navigate to Settings > Inspection.

  3. In the Capture Mode section, select the desired option.

  4. Click OK to confirm your selection.

Browser Mode: In this mode, Qualitia identifies objects using JavaScript events or native events. This mode is useful when you're testing web applications as it works well with most web elements.

Accessibility: By choosing this mode, you can utilize the Microsoft Active Accessibility API to identify objects from the application under test more reliably. This mode is particularly beneficial when testing applications built with technologies that support the Microsoft Active Accessibility API, like .NET.

To select a Capture API:

  1. Launch Object Spy.

  2. Head over to Settings > Inspection.

  3. In the Capture API section, choose the required option.

  4. Click OK to finalize your choice.

By choosing the correct mode and API, you can enhance your testing efficiency and effectiveness.

Footer