Forum Discussion

pyatakov's avatar
pyatakov
Occasional Contributor
8 years ago

How turn off feature - find a similar object? [TC 12.31.1833.7, Firefox 52.0.2 (x32)]

Hi all

 

Anybody can explain what I must do that feature was off ( I mean find a similar object )

 

I will give an example:

 

In NameMapping I had mapping some object with next properties with values:

 

'ObjectType'='Button', 'Visible'='True', 'Exists'='True', 'Enabled'='True' and 'className'='btn*' (I test web)

 

Next

 

When my test was finished in log I found warning event - 

An object recognition hint.

 

Where in Additional Info I was saw next Info

 

'A similar object has been found' and table 

 

 PropertyMapping ValueFoundAction
ObjectTypeButtonButton 
XEnabledTrueFalseUpdate
VisibleTrueTrue 
ExistsTrueTrue 
classNamebtn*btn _fill _disable 

 

Therefore, the attention of the question, comrade connoisseurs - What I must do that turn off that hell feature 'A similar object has been found'? 

 

I DON'T WANT that script spent time for found some a similar object and I DON'T WANT had some warning event in log about that

 

Because, I already know that in at a certain moment mapping object cannot exist, that's why I wait when object to be

ObjectType'='Button', 'Visible'='True', 'Exists'='True', 'Enabled'='True' and 'className'='btn*'

 

Thanks.

  • pyatakov's avatar
    pyatakov
    Occasional Contributor

    Hello, Guys and Girls, 

     

    I think I found some solution, we need:

     

    1. Disable in NameMapping - the option "Extended Find" on the object (in 'Mapping object' panel)

    2. Before start test - for the TestComplete window to set the smallest size 

    3. During test, try set focus on the parent object or on the web page.

     

    These two positions can help!

     

    Enjoy and have fun :)

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Actually, there is a way of turning off the warning.  If you go to name mapping and right click in the properties panel for the object in question.  You'll get the following dialog.

     

     

    Uncheck the indicated item and, for that object, you'll no longer get that warning.

     

    However, if I may add, the mapping properties you have for the object in question are insufficient for unique identification.  

     

    First of all, I wouldn't use the "Enabled" or "Exists" property for an object identification.  If you want to wait for an object to be enabled, use a WaitProperty method off the object and check for "Enabled" = true.  For object existance, I would use "WaitAliasChild" to retrieve the object via the Alias and then check "If object.Exists".

    Secondly, if there is more than one item on the page with a class that matches btn*, it will find whatever the first one is.

     

    If there is a caption, contentText, innerText, or some other property, that would probably be better to include in the properties to identify the object.  Maybe an ObjectIdentifier or an idStr property as well. The warning is there to tell you that your mapping found something but that, because of the properties you've selected, it couldn't find your EXACT item but found something similar.

    • baxatob's avatar
      baxatob
      Community Hero

      Hi Robert!

       

      I know about this feature, but it does not work for me. Don't know why.

      Right now I have created a simple test, which should type few symbols into the some Editor.

      I unchecked "Show Ambiguous Recognition Warning" item for the mapped element (wndTkTopLevel), then ran the test and received again this warning to the log:

       

       

       

       

       

      • pyatakov's avatar
        pyatakov
        Occasional Contributor

        Hi!

         

         

        Please try this

         

        1. Disable in NameMapping - the option "Extended Find" on the object (in 'Mapping object' panel)

        2. Before start test - for the TestComplete window to set the smallest size 

        3. During test, try set focus on the parent object or on the web page.

         

        Is it work?

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      I am second to Robert.

      WaitAliasChild (like any WaitXXXmethod) is standard and recommended way to check if the reference to the object can be get and do not post any messages to the log if the object does not exist.

      Also, I do not think that recognition hint in the log results in significant performance penalty. I believe that while searching for the requested object, TestComplete analyses how well every found object matches search criteria and just displays the most close match candidate if the sought for object is not found.

  • baxatob's avatar
    baxatob
    Community Hero

    Hi,

     

    You can't turn it off, but you can prevent this warning from posting to the log using Event Handler >>

     

    Python implementation:

     

    def GeneralEvents_OnLogWarning(Sender, LogParams):
        if "An object recognition hint" in LogParams.MessageText:
            LogParams.Locked = True