Skip to content
Get Free Trial

Visual Assist Functions

Visual Assist automation is supported since Sahi Pro Visual Assist Engine.

Since
Visual Assist Engine 12.0.0.10

Modes BrowserWindowsAndroidiOS

_getVisualText($element[, $level[, $zoomLevel]])

Arguments

NameTypeDescription
$elementHTML DOM elementElement whose text we need using Visual Assist
$levelstringoptionalSpecifies the iterator level for identifying a text. can be 'word', 'line' or 'para'. Default, value is set as 'word' in "sahi.visual_assist.text.iterator.level" property.
$zoomLevelintegeroptionalIf a text appears too small on the screen, an internal zoom would be necessary to identify such a text. This argument specifies the internal zoom percentage. Default value is 300.

Returns

array of stringsArray of visible text content in the element using Visual Assist

This function will get the string array of visible text present in the element using Optical Character Recognition Technology of Visual Assist.

$message = _getVisualText(_group("message-pane-layout"));
_assertEqual("Success", $message[0]);
// using the 2nd argument as line. This gets string array where each element of the array is a line
$message = _getVisualText(_group("message-pane-layout"), "line");
// using the 3rd argument zoomlevel when the text on the screen is too small
$message = _getVisualText(_group("message-pane-layout"), "word", 400);
Since
Visual Assist Engine 11.0.0

Modes BrowserWindowsAndroid(11.1.0)iOS(11.1.0)

_getTextAi($element[, $level[, $zoomLevel]])

Arguments

NameTypeDescription
$elementHTML DOM elementElement whose text we need using Visual Assist
$levelstringoptionalSpecifies the iterator level for identifying a text. can be 'word', 'line' or 'para'. Default, value is set as 'word' in "sahi.ai_assist.text.iterator.level" property.
$zoomLevelintegeroptionalIf a text appears too small on the screen, an internal zoom would be necessary to identify such a text. This argument specifies the internal zoom percentage. Default value is 300.

Returns

array of stringsArray of visible text content in the element using Visual Assist

This function will get the string array of visible text present in the element using Optical Character Recognition Technology of Visual Assist.

$message = _getTextAi(_group("message-pane-layout"));
_assertEqual("Success", $message[0]);
// using the 2nd argument as line. This gets string array where each element of the array is a line
$message = _getTextAi(_group("message-pane-layout"), "line");
// using the 3rd argument zoomlevel when the text on the screen is too small
$message = _getTextAi(_group("message-pane-layout"), "word", 400);