Forum Discussion

surbhik's avatar
surbhik
Occasional Contributor
3 years ago

Using wildcard in object name

The control I am testing has the followif expression in the full name

WinFormsObject("DocumentsHost", "", 2)

This number 2 is dynamic. I want to use a wild card. May be a '*'. 

Can any one suggest on how I can use a wildcard instead of a number?

7 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    You may use just WinFormsObject("DocumentsHost").

    However, this might result in incorrect object's identification when "DocumentsHost" object with some other but not required index is found first.

    So, if your tested application contains more than one "DocumentsHost" object I would consider some additional criteria to guarantee that the correct expected object is returned.

     

    • surbhik's avatar
      surbhik
      Occasional Contributor

      i tried just '*' and it threw an error and using a * inside quotes also didnt work. ğŸ˜ž

       

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        Where did you use asterisk?

        Screenshot or code line would help.