Double number of items returned by Desktop.ChildObjects

1.3k Views Asked by At

I am trying to get all the open Browser objects using QTP11. The code I use is the following:

Set descBrowser = Description.Create
descBrowser("micClass").Value = "Browser"

Set objChildren = Desktop.ChildObjects( descBrowser )

During testing, i have two IE Browser windows open, but the collection returned by the code shows four found items. I checked the running processes also, which show the correct number of 2 processes running.

I have also checked with 3 Browsers open, in which case it shows 6 objects matching the descrption.

Can anybody explain why this could be happening?

4

There are 4 best solutions below

1
On BEST ANSWER

I see the same behaviour (only for IE not Firefox).

A workaround for this can be to filter out duplicates. For IE if you compare the objChildren(i).GetROProperty("hwnd") you can filter out those with the same value but this will not work if you also use Firefox since in Firefox if you have multiple tabs they all have the same hwnd.

If you have to take FF into consideration you can filter out duplicates using the CreationTime property (instead of the hwnd).

0
On

This is fixed in QTPWEB_00107 - Web Browser Control Recognition in Windows Explorer

0
On

UFT 11.52 + Win7

I had tried several strategies to get this done(PIDs, Title, HWND, browser(index)), and still not success, I am not sure on whether this patch is already there.

What I can picture is that for a simple closing task the UFT is also having issues as it says "Object not visible" when I try to close the Browser() object crashing down the test in random fashion.

The best result was a bunch of already alive IExplorer windows(Tabs) oppened.

Can someone provide steps to check the installed patches ?

0
On

I had the same issue and I had to back out patch QTPWEB_00090 to get it to work. See if you have that QTP patch installed and back it out.