Comparing Text - WinRunner

The compare_text function compares two strings, ignoring any differences that you specify. You can use it alone or in conjunction with the win_get_text and obj_get_text functions.

The compare_text function has the following syntax:

variable = compare_text ( str1, str2 [ ,chars1, chars2 ] );

The str1 and str2 parameters represent the literal strings or string variables to be compared.

The optional chars1 and chars2 parameters represent the literal characters or string variables to be ignored during comparison. Note that chars1 and chars2 may specify multiple characters.

The compare_text function returns 1 when the compared strings are considered the same, and 0 when the strings are considered different. For example, a portion of your test script compares the text string “File” returned by get_text. Because the lowercase “l” character has the same shape as the uppercase “I”, you can specify that these two characters be ignored as follows:

t = get_text (10, 10, 90, 30);
if (compare_text (t, "File", "l", "I"))
move_locator_abs (10, 10);

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

WinRunner Topics