Configure AI Options

Supported in UFT One versions 15.0 and later.

Source code

'************************************************************************************************************************
'Description:
'
'This example opens UFT One and sets its GUI Testing > AI Object Detection > Enable AI Object Detection option to activate UFT One's AI-testing capabilities.
'After making this change, the script restarts UFT One for the changes to take effect, and then sets the other AI-related options
'
'************************************************************************************************************************

Dim App 'As Application ' Declare the Application object variable
Set App = CreateObject("QuickTest.Application") ' Create the Application object
App.Launch ' Start UFT One
App.Visible = True ' Make the UFT One application visible


If not App.Options.AI.Active Then ' If the AI capabilities are currently not activated
    App.Options.AI.Active = True ' Set the option to activate the AI capabilities next time UFT One starts
    App.Quit' Close UFT One
    Set App = CreateObject("QuickTest.Application") ' Create the Application object
    App.Launch ' Start UFT One again
End If

App.Options.AI.EnableAutoScroll = True         ' Set the option to enable auto scrolling
App.Options.AI.AutoScrollDirection = "right"   ' Set the option to scroll to the right instead of the default - down
App.Options.AI.AutoScrollMaxScrolls = 3          ' Extend scrolling to 3 screens instead of the default
App.Options.AI.EnableVerifyIdentification = True         ' Supported in UFT One 2021 and later. Set the option to enable verifying AI object identification
App.Options.AI.EnvsForVerifyIdentification = "Mobile"      ' Supported in UFT One 2021 and later. Specify the environment on which AI object identification is verified
App.Options.AI.IdentificationCacheEnabled = True         'Supported in UFT One 2021 and later. Set the option to enable the cache mechanism for AI-based object identification
App.Options.AI.OCRProvider = "AI"              ' Set the option to use AI text recognition settings, not UFT One's
App.Options.AI.OCRLanguages = "en"              ' Set the option to detect English using OCR
Set App = Nothing ' Release the Application object