Ask a Question

How to avoid the log message "Unable to find the object 'xxx' "

sowmya_bs
Contributor

How to avoid the log message "Unable to find the object 'xxx' "

Hi

I am trying to find an object existance on the page using this below code.



If DialogBoxObject.btnOK.Exists = True Then

   .... ..



End If



But Testcomplete logs an error message "Unable to Find the object btnOK"

This is a log message logged by TestComplete and it points to the statement -DialogBoxObject.btnOK.Exists



I am not sure if it is related to TestComplete settings as i have noticed the same piece of code being used in other script does not log this message as error.



Anyone let me know how to avoid this to be logged as an error message.?



-Thanks

Sowmya BS





6 REPLIES 6
AlexKaras
Community Hero

RE: How to avoid the log message "Unable to find the object 'xxx' "

Hi Sowmya,



It looks like you are using NameMapping in this test project.

If this is the case, you should use WaitNamedChild function to avoid error in the log if the sought for object ws not found.

E.g.:

If (DialogBoxObject.WaitNamedChild("btnOK", 10000).Exists) Then

  ' button was found

End If



See "WaitNamedChild Method" help topic for more details.
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
sowmya_bs
Contributor

RE: How to avoid the log message "Unable to find the object 'xxx' "

This code worked fine when the 'btnOK' was found on the page. It did not log any error message in the log file.

But when the 'btnOK' is existing it fails to identify it and the script fails there.

I have the 'btnOK' in the namemapping.

Here is the below code



If (DialogBoxObject.btnOK.Exists) Then

(this above line is replaced with -  If (DialogBoxObject.WaitNamedChild("btnOK", 10000).Exists) Then

    DialogBoxObject.btnOK.Click()

Else

    DialogBoxObject.btnYes.Click()

End If



but this new line makes the script wait for btnOK, it does not find it even the object exists.

Where am i going wrong?
siddhu
Contributor

RE: How to avoid the log message "Unable to find the object 'xxx' "

Hi Sowmya

        I have same kind of problem which  you have.I have been working on it for the past few days. Please tell me if you found any solution for this problem.I will tell you if i found any solution for this



sai_siddhu451@yahoo.co.in



You can contact me here



Thanks in advance
YMinaev
Staff

RE: How to avoid the log message "Unable to find the object 'xxx' "

Hi,



Check the recognition criteria in your Name Mapping scheme. Most probably, the button is mapped by properties which have unstable values. Also, try obtaining it with the WaitAliasChild method.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Madhi
Contributor

RE: How to avoid the log message "Unable to find the object 'xxx' "

the dumb workaround i use for this kind of issue is log.enabled = false before the obj.exists and log.enabled = true after.

I tried all possible workarounds like waitwpf object etc.  But when i try to look if it exists or not, I get error logs.  So i use this for the timebeing..



Please post the result if you find any...
YMinaev
Staff

RE: How to avoid the log message "Unable to find the object 'xxx' "


Hi All,





This error in the log is caused by the fact that TestComplete cannot find an object by the mapping criteria specified in the Name Mapping tree. It is possible that the actual object that is not found is a parent object of the needed object. The exact object which is not found is specified in the 'Missing Object' section of the message posted to the Remarks pane along with the original error. You need to find this 'missing' object in the Name Mapping tree and make sure that it is mapped by properties that provide reliable and unique identification of the problematic object.





If you cannot find out what's wrong with your Name Mapping scheme, please contact us via the Contact Support form and send us your project suite along with the log of the failed execution.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: