Create script steps based on your application

This topic describes how to use AI Inspection to identify objects in your application and create steps in your script.

Note: This task is a part of a higher-level task. For details, see Create a script.

Inspect your application for objects

Identify the objects in your application using AI Object Inspection. Then add steps to your script that perform operations on these objects.

For the types of objects that can be identified, see the AI-based testing section of the UFT One Help Center.

To inspect your application for objects:

  1. (Optional) Make sure you have successfully launched your application and opened the page with the objects you want to test.

  2. Above the Editor, click the Inspect application button.

  3. Click Live applications in the AI Inspect pane.

  4. Click Web application on the Live applications tab.

    If you haven't launched your application, in the Script applications section, click the ellipsis button on the application card and select Launch and Inspect. To go to the Script applications pane, click Manage applications.

  5. From the list of open browser tabs in the dialog, select the application you want to inspect, and click Inspect.

    To add a selected application to the Script applications pane, click + Add to 'Script applications' in the dialog.

    If the application you want to test is not available in the dialog, select a browser type, enter the application URL, and click the arrow icon to open the application.

  6. Click on your application to start inspecting.

    The Live applications tab starts inspecting the current page and highlighting all identified visual elements by default.

  7. Decide whether you want to view the identified visual elements, text objects, or both, and select the appropriate check boxes.

    Note: To identify text in languages other than English, customize your script settings. See Customize script settings.

  8. Follow steps in Add AI steps to your script to create steps for the current web page.

    Tip: To have another inspection on the current page, click the Re-inspect button , or click the Delayed re-inspect button to set the delay for an automatic reinspection.

  9. To create steps for the next page in your application, go to that page and click the Re-inspect button .

  10. To inspect a new application, click Select a different application .

Back to top

Add AI steps to your script

After you have the objects in your application highlighted, you can add AI steps to your script.

To add AI steps to your script:

  1. Make sure you are in the Live applications tab and that you have inspected your application.

  2. Click a highlighted object.

    A pop-up dialog box with the suggested step and object description opens.

  3. Modify the step action and edit the value field.

    You can click Edit to open a step editing pane and modify additional step details including Text and Position.

    Sometimes, multiple text strings are identified near the object. You can select the one to use for object identification from a drop-down list within the Text box.

  4. Add the new step to your script.

    In the step's pop-up dialog box or in the step editing pane, do one of the following:

    • Click Add step to add the step to your script.

    • Click Add and run to add the step to your script and run it. This verifies that your step is correct and advances the application to the next state, re-inspecting the application for the next step.

      Click the down-arrow and set a delay to provide time for the application to load after running the step, before re-inspecting the application.

    Note: For an object with more than one identified text option, the text option you selected is verified.

    Avoid adding steps with objects that were incorrectly identified. For example, if a button is identified as a text box, or a check mark is identified as a button, such objects may be identified inconsistently and fail in subsequent runs.

    Steps created with AI Inspection are marked with an AI indicator in the Editor, as shown below:

    To edit or fine-tune these steps in the Editor, see Manually create and edit steps.

  5. Save the script.

  6. Associate your script with a Codeless Test or a Unit. See Associate or unassociate your script.

Back to top

Add property-based steps to your script

Add property-based steps to your script using the built-in Spy. Use this option if the AI engine was unable to identify an object. Note that if you add property-based steps, you cannot run the script on a different environment.

To add property-based steps to your script:

  1. (Optional) Open the application you want to test.

    Note: Property-based identification cannot be used on applications opened before the Design Agent was started.

  2. Click the down arrow next to Inspect application and select Property based Identification.

    The mouse pointer is converted into a pointing hand.

  3. Go to your application.

    Hold the CTRL key if you need to suspend the Spy while going to your application.

  4. Click an object that the AI Object Inspection was unable to identify. A dialog box opens with the step name and the identified object name.

  5. Accept the default value or edit it, as required.
  6. Click Apply. A step is added to the Editor.

    The step is marked with a PB (Property Based) icon.

  7. If necessary, modify the step. Click the double arrow icon on the sidebar to display the step editing pane:

    1. Check the Object hierarchy. To modify the captured value, select an entry from the drop down.

    2. Make the necessary edits, such as Object logical name and Action.
    3. Expand the Properties to view the captured description properties of the object.
    4. If your step contains syntax errors, a warning symbol is displayed in the step, the incorrect syntax is underlined, and an error message is displayed in the step editing pane.

    5. For additional step-editing options, see Manually create and edit steps.

  8. Repeat the above steps to spy on additional objects.
  9. Press ESC to exit property-based identification.

Back to top

Next steps: