Object Identification Center

The Object Identification Center (OIC) is a tool that enables you to create unique and robust identifications for application objects.

Note: The OIC is available with trial and design-type licenses.

Overview

The OIC lets you spy objects in your application, determine how to identify those objects, and generate code to use in your scripts.

When opened from an application model, you can also use it to add test objects to the application model. For details, see Add objects to your application model.

The OIC is set up for single object spy mode. In this mode, you spy objects one at a time. However, you can also work in multi-object spy mode, meaning that you spy multiple objects in your application before returning to the OIC for editing and code generation. You can easily switch between modes in the settings. For details, see OIC settings.

By default, the OIC automatically selects a set of recommended test object properties and values to uniquely identify objects. You can change the default in the OIC settings, or use the Apply recommended identifications / Clear selections buttons for a particular object, when necessary.

You can customize object identification and change the properties and values with which to identify objects. When you do, use the Validate button to make sure that your identification is unique.

Back to top

Prerequisites for spying a Web-based application

Before you begin using the OIC, review the following steps:

  1. Make sure your browsers are set up to work with LeanFT. For details, see Set up web browsers and controls.
  2. Open the browser only after the LeanFT engine is running.
  3. If you are working with Microsoft Edge, you must open Edge using Edge Agent for Functional Testing, accessible from the Start screen.
  4. (Optional) Configure how LeanFT identifies objects. For details, see Customize how to identify objects.

Back to top

Open the OIC

The OIC is included in the LeanFT IDE plugin and can be opened from the LeanFT menu, the IDE toolbar, or in standalone mode.

From the LeanFT menu

Click LeanFT > Object Identification Center.

In standalone mode

Windows From the Start menu, click Micro Focus > LeanFT > Object Identification Center.
Linux Run ./oic-leanft from opt/leanft/Tools
Mac Run ./oic-leanft from Applications/LeanFT/Tools

Back to top

Spy objects in your application

Spy objects in your application to obtain identification properties for the spied test object.

Select how you want to spy:

Spy in single object modeClosed

Spy in multi-object modeClosed

To spy in single object mode

  1. Launch the OIC, as described in Open the OIC.

    If you opened the OIC from your IDE, the IDE is minimized and the OIC window opens.

  2. (Optional) Edit the default settings. For details, see OIC settings.

  3. In the OIC window, click the Start spying button.

    The OIC window is minimized, and will be displayed after you have selected your test object.

  4. Hover over objects in your application. Each object you point to in your application is highlighted, and a tooltip displays basic information about the object.

    Tip: Press Ctrl (or command in Mac) to temporarily pause the spying operation. For example, to use your mouse to bring another application into focus.

  5. Click the object in your application to capture it in the OIC.

    The OIC window appears, displaying the object in edit mode. For details, see Edit object identification.

  6. Click an object display name in the object hierarchy to edit it, as required. The generated code will include the name you entered.
  7. To make sure that you have the object that you intended, hover on the object in the left pane, and click the Highlight button next to the object to highlight it in the AUT.
  8. To customize the way objects are identified, see Edit object identification.
  9. To capture an object image, see Capture an image of an object.
  10. To generate code, see Generate test object identification code.

To spy in multi-object mode

  1. Launch the OIC, as described in Open the OIC.

    If you opened the OIC from your IDE, the IDE is minimized and the OIC window opens.

  2. In the OIC, click the Settings button, and then select Allow multi-object spying.

  3. Click the Start spying button.

    The OIC window is replaced by the OIC widget . Once you have completed selecting your test objects, click the OIC widget to return to the OIC window.

  4. Hover over objects in your application. Each object you point to in your application is highlighted, and a tooltip displays basic information about the object.

    Tip: Press Ctrl (or command/cmd in Mac) to temporarily pause the spying operation. For example, to use your mouse to bring another application into focus.

  5. Click objects in your application to capture them in the OIC.

    Note: Wait until the spinner in the OIC widget completes spinning before selecting another object.

    The number of objects captured is displayed on the OIC widget. When you are done, click the OIC widget.

    The OIC window appears, displaying the list of objects you selected.

  6. In the list, click object display names to edit them, as required. The generated code will include the names you entered.
  7. To make sure that you have the object that you intended, click the Highlight button next to the object to highlight it in the AUT.
  8. To customize the way objects are identified, see Edit object identification.

    Note: In edit mode, you can switch to a different object in the hierarchy (such as a parent object). If you choose to return to the list view (click the Back button), then you will be prompted to select which object you want to s[display in the list view: the original one or the new one that you selected.

  9. To capture an object image, see Capture an image of an object.
  10. You can add more objects to the OIC at any time by clicking the Spy additional objects button (hover on the Start spying button to display it).

  11. Click the Start spying button to begin a new spying session. The objects in the current list will be cleared.
  12. To generate code, see Generate test object identification code.

Back to top

Edit object identification

By default, the OIC includes recommended identifications for objects which are unique. You can choose to disable this capability or override it at any time, if you wish to apply customized identification.

  1. If you are in single object spy mode, the OIC automatically opens on the edit page.

    In multi-object spy mode, hover over the object and click Edit.

    The left pane displays the object hierarchy. Stars in the left pane indicate the objects that LeanFT recommends as the hierarchy to identify the object that is currently selected in the OIC.

    The right pane displays the full list of supported identification properties for the selected object and the current values captured from your application. Stars in the right pane indicate the properties that LeanFT recommends as the properties to identify your object.

  2. Select the properties to identify the object and edit their values as required.

    • To enter regular expression values for string properties, click the Set as RegEx star to the right of the value box. For more guidelines on how to specify regular expressions, see Regular expression guidelines.

    • Use CSSSelector or XPath instead of using the object properties, when required. For more details, see Describe objects using XPath or CSS expressions.
    • Use the Clear selections button and the Apply recommended identifications button to easily apply or clear the LeanFT recommended identifications, without changing your OIC settings.
  3. Click the Validate  button on the OIC toolbar to validate your new test object identification.

    All of the objects that match your description are highlighted in your application. A message in the OIC tells you how many objects match the description.

    If no objects were identified, or if multiple objects were identified, adjust the set of properties that you selected and their values, and validate again.

Back to top

Generate test object identification code

In multi-object spy mode, you must select at least one object from your list in order to generate code.

In edit mode, the code will be generated for the object you are editing.

  1. In multi-object spy mode, select the objects for which you want to generate code. Click Select all to select all the objects in the list.

  2. In the OIC toolbar, click the Generate code to clipboard button.

    The generated code is copied to the clipboard.

    By default, the code is generated in the language primarily used by the IDE you are working in. However, by selecting an alternative Clipboard Code Language in the OIC Settings, you can generate the code in other languages. This is helpful if you want to share test object code with Lean Functional Testing testers who are working in another IDE.

  3. Paste the generated code into your test script.

    • By default, object identifications are generated without the full SDK hierarchy. If you are using more than one SDK technology in your test, you may need to resolve ambiguous references.
    • When pasting Web-based generated identifications, the browser parent object is called browser. If you assigned a different name to your browser test object, modify as needed in the pasted code. Similarly, you may want to replace the pasted parent identifications for Windows-based objects with previously defined variables for those objects.

Back to top

Capture an image of an object

Capture an image of the object in your application that corresponds to the currently selected object in the OIC hierarchy tree, and save the image to the file system. This can be useful for image verification.

You can capture images for one object at a time.

Make sure no other application is covering any part of your application while performing the image capture.

  1. In multi-object spy mode, select an object from the list, and then click Edit.

    The object opens in edit mode.

  2. In the OIC toolbar, click the Capture object image button.
  3. Save the file.

Back to top

Add objects to your application model

Add object identifications to your application model using the OIC.

  1. Open an existing application model. For details, see Application models.

  2. In the application model Designer window, click the Object Identification Center button.

  3. Spy objects in your application, as described in Spy objects in your application.

  4. When you are ready to add the objects to your application model, click the Add object to Application Model button.

  5. To check if an object already exists in the application model, click the Locate object in Application Model button.

Back to top

OIC settings

This section includes information on customizing OIC behavior.

(As opposed to customizing test object identification where you can specify identification properties for each object type, as described in Customize how to identify objects.)

In the OIC, click the Settings button.

The following table describes the settings:

Option Description
Clipboard Code Language

By default, Generate code to clipboard generates test object description code in C# or Java, depending on the IDE you are using.

To generate the code in JavaScript, select JavaScript.

If you opened the OIC in standalone mode, all languages are available.

Apply recommended identifications

Automatically selects the set of recommended test object properties and values that uniquely identify an object.

A star icon is displayed next to the recommended objects and properties.

Add page objects to application model

When working with Web applications, select this option to include the Page object in the hierarchy when adding an object to the application model.

The Page objects are not necessary for object identification, but they are helpful in that they help to structure your application model according to the pages in your Web application.

Allow multi-object spying

Spy multiple objects in your application before returning to the OIC for editing and code generation.

Back to top

See also: