Forum Discussion

joaobc's avatar
joaobc
Occasional Contributor
4 years ago
Solved

Exist a way to use Find Method without PropNames, only with PropValues?

Documentation:

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/find-method.html

 

Hello, exist a way where I can use Find Method, without check in source code the Property Name? Lets check the following example, in a grid of Delphi Application:

I don't know the property name, but making manual test I see the text <Sem dados para exibir> inside the grid.

 

 

Reading documentation we can see the:


PropNames [in]    Required    Variant    
PropValues [in]    Required    Variant    

 

But only in PropValues we can use special char * or ? and regular expressions:

"Values can contain asterisk (*) or question mark (?) wildcards, or regular expressions. The asterisk (*) wildcard corresponds to a string of any length (including an empty string), the question mark corresponds to any single character (including none). To specify more complicated parts of the value, use regular expressions."

  • Hi,

     

    I think that your current approach is way better then search by text and no, it is not possible to use .Find() without property names.

     

    P.S. For me this seems to be logical - object itself does not contain any text but only object property can contain some text. What property to consider when searching for the text? So you will need to iterate through all or some of properties. I believe that you can write such iterator yourself if you really need it. Also, it is quite possible that the text that you see does not belong to the grid but is some another object created and displayed by grid when it is empty.

     

2 Replies

  • joaobc's avatar
    joaobc
    Occasional Contributor

    My solution is check (...).grid.ActiveView.ViewData.RecordCount, and check if RecordCount == 0, I just curious about if is possible Find by Text in delphi desktop applications to improve my tests.

     
    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      I think that your current approach is way better then search by text and no, it is not possible to use .Find() without property names.

       

      P.S. For me this seems to be logical - object itself does not contain any text but only object property can contain some text. What property to consider when searching for the text? So you will need to iterate through all or some of properties. I believe that you can write such iterator yourself if you really need it. Also, it is quite possible that the text that you see does not belong to the grid but is some another object created and displayed by grid when it is empty.