Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
Okay, it's obvious from that screenshot that the object exists (note the Exists property).
So... my guess is that the problem is not in finding the object but in the timing of when the object appears.
so, going back to your original code, here's how I would change it.
You already have the object mapped so you don't need to "find" it or identify it in any way. What you need to do instead is wait until the object Exists before proceeding. The above code will wait a maximum of 60 seconds before proceeding. If the dialog box appears within those 60 seconds, the WaitAliasChild method will return the object. If after 60 seconds the dialog object does not appear, a "stub" object with Exists = false will be returned.
The conversation about your mapping has to do with the error about "ambiguous recognition". What that message means is that TestComplete found potentially multiple objects that could all be identified using the same criteria. What I would like to see is the following similar screenshot to help you figure out how to solve that problem. What I have posted should be sufficient to identify your dialog... ASSUMING it is the only instance of that dialog in memory. If you have multiple dialogs open in internet explorer at the time that you hit this section of code, you'll get that "ambiguous recognition" error.
So... my guess is that the problem is not in finding the object but in the timing of when the object appears.
so, going back to your original code, here's how I would change it.
var confirmDlg = Aliases.iexplore.WaitAliasChild("dlgMessageFromWebPage", 60000)
if (confirmDlg.Exists)
{
var okButton = confirmDlg.btnOK
okButton.Click();
}
You already have the object mapped so you don't need to "find" it or identify it in any way. What you need to do instead is wait until the object Exists before proceeding. The above code will wait a maximum of 60 seconds before proceeding. If the dialog box appears within those 60 seconds, the WaitAliasChild method will return the object. If after 60 seconds the dialog object does not appear, a "stub" object with Exists = false will be returned.
The conversation about your mapping has to do with the error about "ambiguous recognition". What that message means is that TestComplete found potentially multiple objects that could all be identified using the same criteria. What I would like to see is the following similar screenshot to help you figure out how to solve that problem. What I have posted should be sufficient to identify your dialog... ASSUMING it is the only instance of that dialog in memory. If you have multiple dialogs open in internet explorer at the time that you hit this section of code, you'll get that "ambiguous recognition" error.
Related Content
- 7 years ago
- 11 years ago
Recent Discussions
- 23 minutes ago
- 2 hours ago