Highlighted
Absent Member.
Absent Member.
246 views

verify an item is within square brackets

i have a situation where i need to check if the selected item is native language or english.  native languages are enclosed in square brackets.  how can i check for square brackets.

0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

Re: verify an item is within square brackets

Assuming the string is contained in a webedit or perhaps a weblement, then I would say that the easiest way would be via a GetROProperty method. e.g.

if you don't care about the string content, you can use a regular expression to check the string begins and ends with [ and ] and the text in the middle can be anything. (as [ and ] are special characters the \ is to ensure they are treated as literals)

if browser(...).Page(...).Webelement(...).GetRoProperty("innertext") = "\[.*\]" then
       ' native language
else
       ' english
End if

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.