1
votes

I can not access an object in my testcase. The object is a Tab, attached to a (Sub)Window in my application. Befor and after the Testcase the Tab and the window the tab is attached to is found by the object spy fine, but while the testcase runs the Error below comes up .

Cannot find the "[ActiveX]" object's parent "[Window]" (class Window). Verify that parent properties match an object currently displayed in your application.

I access the object so :

VbWindow("ApplicationWindow").Window("SubWindow").ActiveX("Tab")

I am new to UFT, so I searched a while and found some solutions but they seem not to work for me, because they always related to browser testing, not application.

2
Ok, you say the window and the tab attached are found by the object spy. Can you make sure your script can find and interact with ApplicationWindow and SubWindow? - olyv
Is the Smart Identification property of the object set to True? If so, change it to false and try to highlight the object from the Object Repository. In case there is more then one match for the object, UFT will throw a pop-up message saying so and, if that is the case, you can try to refine your object properties - Victor Moraes

2 Answers

0
votes

Warning: Long explanation follows, you can skip to the last paragraph for a suggested quick win.


When UFT identifies objects it does so from the top down, your object hierarchy is:

VbWindow("ApplicationWindow").Window("SubWindow").ActiveX("Tab")

And UFT said that:

Cannot find the "[ActiveX]" object's parent "[Window]" (class Window).

This means that id did find VbWindow("ApplicationWindow") but could not find the Window("SubWindow"). Try highlighting the VbWindow to make sure that UFT is identifying the object you expect. Then use the object spy to inspect the window you think UFT should find. Then compare the properties in the object repository to those of the window you see and find how these descriptions differ.

As a shortcut you can try using Maintenance Run Mode which should do these steps for you and suggest a way to fix the test.

0
votes

Just a thought to identify the root cause of the problem.

1.Try with the top level container(skipping the next level container) and check your existence of parent.

VbWindow("ApplicationWindow").ActiveX("Tab")

2.Check the properties before and after. I meant side by side validation. There could be the chance of property mismatch.

3.Use Refresh Object method.

Window("Calculator").RefreshObject

4.Query your parent from the Tab object

Set objParent =  VbWindow("ApplicationWindow").ActiveX("Tab").GetTOProperty("parent")
Msgbox objParent.GetROProperty("text")
Set objParent =  VbWindow("ApplicationWindow").Window("SubWindow").ActiveX("Tab").GetTOProperty("parent")
Msgbox objParent.GetROProperty("text")