简体   繁体   中英

Double number of items returned by Desktop.ChildObjects

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?

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 ?

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 ).

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.

QTPWEB_00107 -Windows资源管理器中的Web浏览器控件识别已解决此问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM