AI-based testing in UFT

GUI UFT Mobile and Web tests only

This topic describes how to install and use UFT Artificial Intelligence (AI) Features to identify objects the way a person would, enabling you to run the same test on different platforms and versions, regardless of the objects' implementation.

Note: In UFT 15.0, AI-based testing is supported for mobile testing only.

In UFT 15.0.1, desktop web support is added as a technical preview.

AI-based testing overview

UFT AI Features enable your tests to interact with the application you are testing in the same way a person would. UFT uses AI to identify objects visually, based on a wide variety of images, context, and sometimes text.

For example, UFT AI can identify many forms of search fields, user profile areas, input fields, button, shopping carts and more.

Some advantages of AI-based object identification are: 

1. More intuitive test scripts.

2. Tests are technology agnostic, identifying objects visually, regardless of the UI technology details used behind the scenes.

3. Tests are easier to maintain, as an object changing location, UI framework, or even shape, won’t break the test script as long as the object remains visually similar or its purpose remains clear.

Back to top

Install and enable UFT AI Features

To use UFT's AI features, you need to install them, and enable them in the Options dialog box:


Before installing the AI features, make sure you have the following installed: 

  • UFT

  • Microsoft Visual C++ 2013 Redistributable

  • One of the following Windows features, depending on your Windows operating system:

    Operating system Required Windows feature
    Windows OS Microsoft Media Feature Pack
    Windows Server 2008 Desktop Experience
    Other Windows Server OS Microsoft Media Foundation

Install UFT AI Features

Install the version of AI Features that is delivered with your UFT version.

  • For UFT 15.0, install UFT AI Features version 2.0

  • For UFT versions 15.0.1 and later, the UFT AI Features version number matches the UFT version number.

You can run the installation manually, using the setup wizard or you can run it silently from a command line.

Manual installation Silent installation

From the UFT DVD, run AI\setup.exe installation file and follow the on-screen instructions.

When selecting the features to install, you only need the AI Engine.

msiexec /qn /i "<UFT DVD>\AI\AI_Installer.msi" ADDLOCAL="AI_Services"

Note: The AI Codeless Testing Tool feature is not part of UFT. It is a standalone tool that lets you experiment with AI Codeless testing. Installing AI Codeless requires additional prerequisites. See the UFT AI Codeless Help Center.

Enable the UFT AI features

  1. Open the Options dialog box to the AI pane of the GUI Testing tab (Tools > Options > GUI Testing > AI).
  2. Select the AI active option.
  3. Restart UFT.

If you use the Generate Script option in the Options dialog box, the AI Active option is included in the script. For details, see General Pane (Options Dialog Box > GUI Testing Tab).

Add a statement to the generated script to restart UFT if this option's value is modified. For details, see the Options Object > AI Property section of the UFT Automation Object Model Reference.

Back to top

Inspect your application for objects

Use AI inspection to identify objects in your application that you can use in your test steps.


If you are testing an application on a mobile device If you are testing a desktop web application
  1. Make sure the Mobile Add-in is installed and loaded.

    To test web applications on your mobile device, make sure the Web Add-in is installed and loaded.

  2. Connect to UFT Mobile and open your mobile device and the application you want to test. For details, see Open a remote access window and application manually.

  1. Make sure the Web Add-in is installed and loaded.

  2. Open the application.

    For best identification results:

    • Maximize the browser window and set zoom level to 100%.
    • Set your Windows display settings to display all text and apps at 100%.
    • Make sure no banners are displayed in the browser in addition to your web page.

Supported browsers: Chrome, Chromium-based Edge, Firefox, Internet Explorer.

Headless browsers are not supported.

Inspect your application

Help design the future of AI-based testing in UFT

Click How is the detection? Help us improve to open the Feedback Tool and send Micro Focus feedback about the object detection. For details, see AI-based testing Feedback Tool.

Back to top

Verify support for selecting from a combo box (Optional)

Supported on UFT versions 15.0.1 and later

Selecting items from a combo box is a complex operation. UFT can perform a Select operation on a combo box identified by AI only if it can also identify this combo box as a WebList or a MobileDropDown.

When inspecting your application for objects using AI, if UFT identifies a combo box, it displays a Verify icon on the object. Click this icon to check whether UFT can run Select operations on this object before adding such steps to your test.

Tip: Try verifying more than once. Depending on various environment conditions, even if verification failed, UFT may find the necessary object on subsequent attempts.

Back to top

Add AI-based steps to your tests

Set the AI context

Before you can run any AI-based steps in your test, you must set the context in which to use AI. Add a statement to your test similar to this one: 

AIUtil.SetContext Device("device")

UFT 15.0: The context must be a mobile Device test object that exists in your object repository.

UFT 15.0.1 and later: The AI context can be one of the following: 

  • A mobile Device test object stored in your object repository.

  • A web Browser test object stored in your object repository or described using descriptive programming.

    The web Browser can run on a Desktop or Mobile device, and be opened manually or from the Record and Run settings.

Note: UFT must be able to identify the context object throughout the test run. If necessary, use additional SetContext steps to select a different object for the context.

Add test steps

You can add AI-based steps to your test in one of the following ways:

  • Drag and Drop the identified Object or Text from the Object Spy or the AI Identification View window into your test.

    The step added for each object includes any information used to identify it uniquely, such as associated text or the objects relative location on the screen. See Associating text with objects and Identifying objects by relative location.

  • Edit your test using the AIUtil object.

    Next, use the AIUtil object to identify the control by type, text, or a combination thereof, and to perform operations on the objects, such as Click, Type, or Search.

    For details, see AI-based Testing in the UFT Object Model Reference.


The following example clicks a settings control on a mobile device and then types a user name in the appropriate field. Both controls are identified visually using AI.

Next, the Log In text is located on the screen and clicked.

After logging in, this example clicks an "ON" button. Since the application contains a few similar buttons, the example specifies that button to click is the third button from the top.

AIUtil.SetContext Device("device") 'Set the context for AI
AIUtil("input", "USER NAME").Type "admin"
AIUtil.FindTextBlock("Log In").Click
AIUtil("button", "ON", "FromTop", 3).Click

Tip: UFT generates steps that use FindTextBlock, as the spy identifies full blocks of text. When you create your own steps, consider using the FindText method, which will match the text you provide, even if it is only part of a larger text block.

Back to top

Continue to the application's next screen

When you finish creating test steps for one page or screen in your application and you want to continue on another one, navigate to the desired location in the application itself. Then, in the AI Identification View window, click REFRESH to load the new application screen and re-inspect it.

  • When working with a mobile application, navigate to the correct location in your application directly on the device or using the remote access window.

  • If multiple remote access windows or browser windows are open, the inspection session interacts with only one.

    UFT 15.0.1: You can switch to inspect other browser windows or mobile devices that are open on your computer. Click CHOOSE in the AI Identification View window and select a different browser or device.

Back to top

Run AI-based tests

After inspecting your application and creating test steps, run your AI-based test as you would run any other UFT test. See Run / Debug tests.

You can run the same test on different operating systems and versions, as it is not based on implementation details.

Back to top


AI text identification requires the Windows mediaserver.exe service to be running.

If the following occurs, open the Windows Services Manager and make sure the mediaserver.exe is running:

  • AI inspection cannot find objects By Text
  • All FindText and FindTextBlock steps fail to return an AITextObject when running a test

Back to top

See also: