AIRunSettings Object
Supported in UFT One versions 15.0.2 and later.
Description
An object containing the settings for the current test run. These settings enable you to modify test settings during the test run, overriding the global settings defined in Tools > Options > GUI Testing > AI.
IMPORTANT
AI objects are supported in UFT One only when:
- The UFT One Web Add-in or Mobile Add-in are installed and loaded.
- The UFT One AI Features are installed and AI is enabled in the UFT One options. For details, see the UFT One Help Center.
To retrieve an AIRunSettings object, use the AIUtil.RunSettings property.
The settings in an AIRunSettings object are arranged in child objects, each for a different type of settings. Use the relevant object property to retrieve the child settings objects.
Properties
The following table lists the built-in properties that you can use to access the settings child objects.
AutoScroll | Returns the AIRunSettingsAutoScroll object to use for the current test run. Syntax AIUtil.RunSettings.AutoScroll |
OCR | Returns the AIRunSettingsOCR object to use for the current test run. Syntax AIUtil.RunSettings.OCR |
TextMatch | A String value. Specifies whether to look for the specified text exactly when identifying AI test objects, or use AI algorithms to find similar text as well. Syntax AIUtil.RunSettings.TextMatch Possible values: micExactMatch, micAIMatch Remarks
|
'The following example instructs UFT to look for an exact match for "username"
' when identifying a text box using AI. Then it instructs UFT to go back to AI text recognition
AIUtil.RunSettings.TextMatch = micExactMatch
AIUtil("text_box", "username").Type "test"
AIUtil.RunSettings.TextMatch = micAIMatch
AIRunSettingsAutoScroll Object
Description
Controls automatic scrolling for AI identification in the current test run.
By default, the automatic scrolling is on, and set to scroll down, up to 2 times.
Important
To retrieve an AIRunSettingsAutoScroll object, use the AIUtil.RunSettings.AutoScroll property.
Methods
The following table lists the methods you can call to control the run time AutoScroll settings:
'The following example scrolls down (based on the default settings) to highlight
' the SEE OFFER button, and then scrolls back up to highlight the SPEAKERS text
Util.SetContext Browser("creationtime:=0")
Browser("creationtime:=0").Navigate "https://www.advantageonlineshopping.com"
AIUtil("button", "SEE OFFER").highlight
AIUtil.RunSettings.AutoScroll.Enable "up", 2
AIUtil.FindTextBlock("SPEAKERS").highlight
AIRunSettingsOCR Object
Description
Specifies the OCR settings to use in the current test run.
By default, only English text is identified.
Important
To retrieve an AIRunSettingsOCR object, use the AIUtil.RunSettings.OCR property.
Properties
The following table lists the properties that represent the run time OCR settings:
'Though UFT is configured to work in English in the AI OCR options, override this
'and use English and French as the languages the AI OCR will use to detect texts
AIUtil.RunSettings.Ocr.Languages="en, fr"
AIUtil.FindTextBlock("Se connecter en toute sécurité").Click