Forum Discussion

marinb's avatar
marinb
Contributor
14 years ago

Problem with using wildcards in Object finding

I am using a function (javascript) to find objects in the application by checking the properties of an object (using Find & FindAllChildren)



The help states you can use * or ? as wildcards.



The function is looking for an object with the following contents in the .Name property:



*WPFObject("TextBlock", "*", 8)*



However, it finds 2 objects with contents:



WPFObject("TextBlock", "1", 8)  and

WPFObject("TextBlock", "8", 7)



What am I doing wrong in this? According to me, it should explicitly look for ", 8 and ignore the object with ", 7

Does TestComplete have trouble with multiple *'s in a search string?



 

12 Replies

  • It's passed via this line (slightly adjusted for ease of read):



    var sSearchString = '*WPFObject("TextBlock", "*", 8)*';

    var oEntryField= FindObject("RightPane", "Name", sSearchString, "VisibleOnScreen", true);




    "RightPane" is a frame we have mapped to improve performance. It will look inside that frame for the entry field that is visible.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Ah, gotcha... the problem is the string you're passing in.  In JScript, the quote characters are "special" characters and need to be indicated differently.  Change your line as follows:



    var sSearchString = '*WPFObject(\"TextBlock\", \"*\", 8)*';




    Let me know if that helps.