Object Identification Center (OIC) for Selenium

When writing a Selenium test, use LeanFT's Object Identification Center (OIC) for Selenium to identify (spy) objects in your application, experiment with different ways to identify those objects, and generate code to use in your scripts.

Note:  

  • The OIC is available with a trial or design-type license.

  • The OIC for Selenium is supported for Selenium projects on Windows, Linux, and Mac environments.
  • Currently, the OIC for Selenium does not support spying in the Safari browser (on Mac). However, you can use the LeanFT extended Selenium locators and utilities when running Selenium tests in Safari.
  • For LeanFT projects on Windows, see Object Identification Center (OIC) - Windows

  • For LeanFT projects on Linux/Mac, see Object Identification Center (OIC) (Linux/Mac)

The OIC (Selenium) window

Back to top

Spy your application and validate a test object

Spy your application to uniquely define a test object.

  1. Prerequisites

    1. Make sure your browsers and WebDrivers are set up to work with LeanFT.
    2. Make sure the LeanFT runtime engine is up and running.

  2. Launch the OIC from:

    • Your IDE's LeanFT menu > Selenium > Object Identification Center
    • Your IDE's toolbar

    For example, in Eclipse on a Linux environment:

    Tip: In Windows, you can open the OIC in standalone mode from the Start menu (HPE Software > HPE UFT Pro (LeanFT) > Tools > Selenium > Object Identification Center.

  3. In the top left corner of the OIC window, click the Browser launcher button to select and launch a browser.

    Note for Firefox users: 

    For Firefox version 46 and earlier, click Firefox.

    For Firefox version 48 and later, click Firefox Gecko.

    Arrange your browser and OIC windows so that you can see both on the screen, or use dual monitors to display one on each screen.

  4. In the OIC, click the Start spying  button.

    Tip: If you have just opened the OIC, a large green Start spying button appears in the center of the OIC window.

  5. Hover over objects in your application. As you hover each object, it is highlighted and a tooltip displays some basic information about the object.

  6. Click an object to capture its details in the OIC.

    On the left of the OIC window, the hierarchy tree displays the object's full hierarchy.

    On the right, the OIC displays the full list of supported locators for the selected object, and the current values captured from your application.

    Tip: To highlight an object in the application, hover over the object's node in the hierarchy tree, and click Highlight icon.

  7. In the hierarchy tree, select an object to identify. Click anywhere in the object's node, and select the check box as well.

  8. On the right, select locators that you want the OIC to use to identify the test object.

    Tip: You can modify the values for any selected locator. To enter a regular expression value for a string, click the Set as Regular Expression asterisk to the right of the value box. For more details, see Regular expression guidelines.

  9. Hover over the Start spying button to show the floating toolbar, and click the Validate button.

    LeanFT searches the application for objects that match the object's description in the OIC.

    Matching objects are highlighted in your application. A message displays how many matches were found.

    Note: If more than 20 matched are found, the objects are not highlighted in the application.

    If no matches are found, or if multiple matches are found, adjust the set of locators that you selected, and/or their values, and try to validate again. Repeat until you get a unique match.

Note: To stop spying, press the Esc key while focused inside the browser.

Back to top

Generate test object description code

After you have spied a test object and validated that you have a unique test object description, you can generate code for it, and paste the code into your test script.

  1. Hover over the Start spying button and click the Generate code to clipboard button.

    A programmatic description of the test object is generated, and is copied to the clipboard.

  2. In your IDE, paste the code into your test script.

    Note: When you paste the generated code, the browser parent object is called driver. If you assigned a different name to your browser test object, modify as needed in the pasted code.

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. This can be useful, for example, if you are building a reporting framework for test executions.

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

  2. Firefox/IE users: Make sure that the tab containing the test object is in focus.
  3. In the OIC, make sure the object you want to capture is both in focus in the hierarchy tree, and that its check box is also selected.

  4. Hover over the Start Spying button, and click the Capture object image button.

  5. Save the image.

Back to top

See also: