Ask a Question

I have two dialog boxes with the same title, how do I reference the right one?

Occasional Contributor

I have two dialog boxes with the same title, how do I reference the right one?

Hi, please see the attachment.  I am testing a program that has both "Create siteplan plan" as the dialog box title.  In the screenshot, the small dialog box comes up within the background dialog box.  I want TC to click OK on the button.  This is who I would do it in the script:


If I run this command, I will get an error message "the object does not exist".  I'm sure it's because it is looking for the OK button in the background dialog box, which doesn't have an OK button to click.  The background dialog box is also not active, the small one is.

Given all this, how do I reference the small dialog box?  Is there a way to reference it by some PID, or a maybe a child dialog box?



Hi Justin,

The cause of this issue is that the dialog is mapped to a custom name ('dlgCreateSiteplanTable') by a set of properties that satisfy both the dialog and the message box. In this case, TestComplete uses the same mapped name during the recording to record a click to the OK button on the message box. At the same time, during the playback, TestComplete does not search for the message box as the 'dlgCreateSiteplanTable' name is referencing an existing dialog object. As the dialog object does not contain the OK button, the test fails.

To solve the problem, you need to call the RefreshMappingInfo method of the problematic object to force TestComplete to search for the message box regardless of the fact that the 'dlgCreateSiteplanTable' object is referencing an existing object already:



If this does not help, you need to map the dialog window and the message box to different names by properties that identify these objects uniquely. If there are no such properties, you can use the 'Required Children' feature to differentiate between these objects. Please see the Specifying Child Objects Required for Mapped Object Identification help topic for more information.

If you still cannot find a way to solve the problem, please reproduce the issue, pack the entire project suite folder and send me the archive via the Contact Support form.
Dmitry Nikolaev

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

Thank you, this is very helpful.  I was also able to solve the problem by referencing to the message box by it's full name:

Sys["Process"]("OptPCS")["Window"]("#32770", "Create siteplan table", 1)["Window"]("Button", "OK", 1)["Click"]()
Showing results for 
Search instead for 
Did you mean: