I've 'Report' where Report is #32770 class. |
What other criteria do you use in your name mapping for this object? Is the only thing you're using the #32770 class? If so, then I'm not surprised as there are many other objects, items, etc., that may appear with that same class.
Additionally, is this coming from a web page through Internet Explorer? If so, what is the whole hierarchy of objects leading up to that object? The reason being is that, starting with, I believe, Internet Explorer 7, IE can spawn multiple processes. So, your original mapping MAY have been for process with an ID of 1, but subsequent runs of your tests may have the Report object coming up from other instances of IEXPLORE running in Windows. There is a solution for this where you would need to adjust your registry. I don't have the link immediately available but a search of these forums should find something about that.
use WaitNamedChild to get Print Button in 'Report' - mapped name - 'Print' - properties mapped with - objecttype = Button, objectidentifier = Print. There is only one child with these properties. (screenshot attached)
validate after this call doesn't exist: validate = parent["WaitNamedChild"](name, 0); (where parent is Report object and name is "Print") |
Where error shows up in your test log on this? There's an additional information panel in your test log which may give additional information. The problem may not be in the Report object or in your ability to find the Print object might might, as noted above, be further up in the hierarchy in that the instance of Internet Explorer that your original mapping references may not have your Report object on it but it may be on a different instance of IEXPLORE.
I see your screen shot of the object in question, could you provide screenshots of your NameMapping hierarchy for the object (including the "tree" of objects from Sys up through the Report object), and the properties you're using for Mapping report?
As a workaround, I call FindChild, two properties, visible, mappedname, depth=0. Report can have anywhere from 20-70 children, so this is quite slow, but finds it all right. So far, I've seen this fail only when parent is class #32770, but not consistently. |
I would not use MappedName in a FindChild call at all because MappedName is first of all depending upon the object being recognized as being mapped in NameMapping. If you're already having trouble with WaitNamedChild, MappedName will almost certainly fail. Again, I think the root cause of the problem is not with the Print button itself, but something in how you're mapping to the Report object is handled.
Now, another possibility is that this call to find the print button is probably occurring after some sort of test step that generates the report in the first place. So, there is probably a delay between clicking the button to generate the report and when the report appears on screen. I would suggest going further up in your code and getting your actual Report object using a WaitChild or WaitNamedChild or something and using a delay parameter of something significantly greater than 0 (like 60000). This will cause TestComplete to wait until the object resolves up to that timing before moving on. A delay parameter of 0 basically says "don't wait" and you'll most likely fail pretty quickly if the object doesn't resolve equally quickly.
Hope this helps you in finding what's going on.