引用:
原帖由 jackymail 于 2008-1-10 01:48 发表 
替代方案:oDesc("regexpwndclass").Value = "Notepad"
Desktop好像有点问题,普通的根对象用这种方法没问题。期待正解
看来是Desktop对象有问题。
打开notepda的font设置,运行下面代码,可以找到font对话框
Set oDesc = Description.Create()
oDesc("regexpwndtitle").Value = ".*t$"
oDesc("regexpwndtitle").RegularExpression = True
Set OpenedNotepadWindows=Window("regexpwndclass:=Notepad").ChildObjects(oDesc)
msgbox OpenedNotepadWindows.Count ' you get 1
Set oDesc = Nothing
没有其他办法的话,只好用GetROProperty绕过去了。
以下是国外论坛上找到的同样问题,有回复如下:
http://www.sqaforums.com/showfla ... PSESSID=#Post446909
==============================
Re: Newbie QTP Regular Expression Difficulties [Re: gy21st]
#447101 - 01/09/08 08:31 AM
Edit post Edit Reply to this post Reply Reply to this post Quote Quick Reply Quick Reply
ChildObject implementation is not always reliable and as per my recent SR with HP they told me that RE might not always work for some properties. And i doubt that Desktop.ChildObject would be as good as Browser().Page().ChildObjects
Because Desktop is not a TestObject but a reserved object.
--------------------
Tarun