Forum Discussion

lleppert's avatar
lleppert
Contributor
8 years ago
Solved

Is there a way to turn off object recognition hint in TestComplete12?

Hello,

 

We just updated to TestComplete12 and after our lab run we noticed we had about a dozen of our tests start spitting out warnings for "Object Recognition Hints". These tests were not failing before the update, and in fact move past the hint and complete successfully. 

 

I tried clicking 'Update' but it just said that the property was not found in Name Mapping and then gives me an 'Invalid variant type' error. Is there a way to simply turn this feature off or possibly ignore the warning as you can with ambiguous warnings?

 

Thanks in advance. 

  • Hello,

     

    We haven't found an option to turn off this new feature.

    If this helps, we are blocking the warning via the Events/GeneralEvents/OnLogWarning:

     

    Sub GeneralEvents_OnLogWarning(Sender, LogParams)

    ' Block the warning "An object recognition hint" from TC12

    If LogParams.MessageText = "An object recognition hint. See Additional Information for details." Then

    LogParams.Locked = True

    End If

    End Sub

     

    Regards

     

18 Replies

  • wcach's avatar
    wcach
    New Contributor

    Hello,

     

    We haven't found an option to turn off this new feature.

    If this helps, we are blocking the warning via the Events/GeneralEvents/OnLogWarning:

     

    Sub GeneralEvents_OnLogWarning(Sender, LogParams)

    ' Block the warning "An object recognition hint" from TC12

    If LogParams.MessageText = "An object recognition hint. See Additional Information for details." Then

    LogParams.Locked = True

    End If

    End Sub

     

    Regards

     

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      If this is the code you are using, or something similar... 

      if Aliases.Device.pnlBack.WaitProperty("Exists", True, 1000) = true then
         call Aliases.Device.pnlBack.Touch
         delay(2000)
      end if

      Then the problem is actually pretty simple to solve. You cannot call the "WaitProperty" method on an object that does not exist. If there is no object, you can't call a method on the object. 

      What you need to do is use WaitAliasChild. Change your code to

       

      if (Aliases.Device.WaitAliasChild("pnlBack", 10000).Exists) then
         call Aliases.Device.pnlBack.Touch
         delay(2000)
      end if

      That SHOULD correct your object recognition problem.

      WaitProperty should only be used if you know the object exists and for detecting changes in a property value, not changes in the existance of an object.

    • lleppert's avatar
      lleppert
      Contributor

      Brilliant. I didn't think to use an event handler. Thanks so much wcach!

    • bo_roop's avatar
      bo_roop
      Contributor

      So this is a nice suggestion from wcach to keep the stuff out of the log file, but I'm still waiting the five minutes for TestComplete replay to get past the object recognition hint nonsense.

       

      Worse is that in my case TestComplete has already clicked the button it's busy hunting for and the window that button was on has been closed (because that's what the button does)!

       

      Is there ANY way to actually shut off the Hinting? Not logging the warning doesn't help if it still waits the five minutes hunting for the missing buttons.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Yes.... map your objects better. :)

         

        Honestly, it comes down to doing a better job of selecting identification properties  for your mapped object so it doesn't give the hints and warnings.  It means investigation and a bit of elbow grease to find a better way of identifying your object.   I'm guessing that you're using Extended Find in your name mapping... you might need to add additional hierarchy into your NameMapping to drill down closer to the object.

  • Orvai's avatar
    Orvai
    Occasional Contributor

    Hello,

     

    we have the same problem with our test suite. We are using VBScript as language in Testcomplete and are testing a WinForms application.

     

    There are many parts in our test functions where it might be possible that a message box opens, depending on the input to the tested application (error messages etc.). In Testcomplete 12 I always get that object recognition hint, and it is clear the object can not be recognised, because it does not exist.

     

    Is there a way to avoid this warning? Maybe there is a better way to check if a window appeared or not?

     

    Best regards

    • lleppert's avatar
      lleppert
      Contributor

      Thanks for responding Orvai, I'm glad we are not the only ones having this problem. 

       

      The strange thing about my problem is that neither the Mapping Value or the Found Value in the recognition hint are the value that we are trying to access at that particular step, so I cannot even alter the mapped value to make it happy.

       

      This post hasn't gotten any answers so I am going to start a support case today. 

      • larolsen's avatar
        larolsen
        Contributor

        I have the same issue

         

        When using the following script:

         

        if Aliases.Device.pnlBack.WaitProperty("Exists", True, 1000) = true then
           call Aliases.Device.pnlBack.Touch
           delay(2000)
        end if

         

        I get warnings in the log when the pnlBack doesn't exist. This wasn't an issue in TC11. This shouldn't create warnings, and is making my testreports look worse than they are.

         

        Any hints to how to avoid the object recognition hints warnings in the log?

         

        /Lars