Sometimes developers change the object property like “Name” and the automation script stops identifying the object. In such situation TestComplete allows the use of regular expression to find the object.
In the below example, the “Name” property changed for the control object from “txtUsderName” to “TextBoxUserName”.
Using regular expression the object can be identified even if its “Name” is changed-
objwin = Sys.Process(“VIP”).WinFormsObject(“LoginForm”)
var txtbox = objwin.FindChild(“Name”,”regexp:t.*Name“)
The .* pattern matches a string of any length (including the empty string) that does not contain the newline symbol.