51Testing软件测试论坛

标题: 判断对象为啥不存在? [打印本页]

作者: hotsmile99    时间: 2011-4-16 08:13
标题: 判断对象为啥不存在?
Set g_Dialog = Browser("title:=.*").Window("regexpwndclass:=Internet Explorer_TridentDlgFrame","is owned window:=True","is child window:=False","index:=0")
if g_Dialog.Exist then
''do something
end if
这段是没有问题的

但当我把 regexpwndtitle 加入,怎么判断就不行了

Set g_err= Browser("title:=.*").Window("regexpwndtitle:=网页对话框","regexpwndclass:=Internet Explorer_TridentDlgFrame","is owned window:=True","is child window:=False","index:=0")
if g_err.Exist then
''do something
end if

但是 g_err.Exist不存在,是什么原因?
作者: 云层    时间: 2011-4-16 09:26
说明对象不是这个regexpwndtitle你用spy object看一下就知道了
作者: hotsmile99    时间: 2011-4-16 11:00
我就是用这个对象的呀,对象抓出来导出的xml里面取得值呀!!!
作者: kavensyw    时间: 2011-4-17 20:10
本帖最后由 kavensyw 于 2011-4-17 20:13 编辑

在第一条语句,运行时,用GetRoProperty抓一下regexpwndtitle属性值呢,能抓到吗?

Set g_Dialog = Browser("title:=.*").Window("regexpwndclass:=Internet Explorer_TridentDlgFrame","is owned window:=True","is child window:=False","index:=0")
if g_Dialog.Exist then
    msgbox g_Dialog.GetRoProperty "regexpwndtitle"       '这儿不知道用不用加括号,忘了
end if
作者: ddtianle    时间: 2011-4-18 13:47
回复 4# kavensyw
要加括号的。
作者: hotsmile99    时间: 2011-4-19 18:53
谢谢!!已经搞定了




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2