简体   繁体   English

Desktop.ChildObjects返回的项目数的两倍

[英]Double number of items returned by Desktop.ChildObjects

I am trying to get all the open Browser objects using QTP11. 我正在尝试使用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. 在测试期间,我打开了两个IE浏览器窗口,但是代码返回的集合显示了四个找到的项目。 I checked the running processes also, which show the correct number of 2 processes running. 我还检查了正在运行的进程,这些进程显示正确数量的2个正在运行的进程。

I have also checked with 3 Browsers open, in which case it shows 6 objects matching the descrption. 我还检查了3个浏览器是否打开,在这种情况下,它显示了6个与描述匹配的对象。

Can anybody explain why this could be happening? 谁能解释为什么会这样?

UFT 11.52 + Win7 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. 我尝试了几种策略来完成此操作(PID,标题,HWND,浏览器(索引)),但仍然没有成功,我不确定该补丁是否已经存在。

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. 我能想象的是,对于一个简单的关闭任务,当我尝试关闭以随机方式使测试崩溃的Browser()对象时,UFT也会显示“对象不可见”的问题。

The best result was a bunch of already alive IExplorer windows(Tabs) oppened. 最好的结果是取消了一堆已经存在的IExplorer Windows(Tabs)窗口。

Can someone provide steps to check the installed patches ? 有人可以提供检查已安装补丁程序的步骤吗?

I see the same behaviour (only for IE not Firefox). 我看到相同的行为(仅适用于IE,而不适用于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 . 对于IE,如果您比较objChildren(i).GetROProperty("hwnd") ,则可以过滤出具有相同值的值,但是如果您还使用Firefox,则无法使用,因为在Firefox中,如果您有多个选项卡,它们都具有相同的hwnd

If you have to take FF into consideration you can filter out duplicates using the CreationTime property (instead of the hwnd ). 如果必须考虑FF,则可以使用CreationTime属性(而不是hwnd )过滤出重复项。

I had the same issue and I had to back out patch QTPWEB_00090 to get it to work. 我遇到了同样的问题,必须退出补丁QTPWEB_00090才能使它工作。 See if you have that QTP patch installed and back it out. 查看是否已安装该QTP补丁并将其撤消。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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