QTP检查WEBbutton是否存在
Dim MyButtons,ButtonMyButtons=array("Search","Reset")
For Button=0 to ubound(MyButtons)
Environment("MyButtons")=browser("name:=ecVision.*","title:=ecVision.*").Page("title:=ecVision Suite","name:=discussWin")._
frame("html id:=clientframe").webbutton("html id:=commonSearch"&MyButtons(Button)&"Btn").exist
代码如上,在检查webbutton时是否存在时,QTP检查一直不存在,实际程序已经跳转到该页面,该button实际存在
附上button属性 :o对象库里都这些对象了为何还要用描述性编程,自己增加难度?而且你还描述错了。。。。 回复 2# joykao
哪个地方描述错了,可以指出么? Dim MyButtons,Button
MyButtons=array("Search","Reset")
For Button=0 to ubound(MyButtons)
If browser("name:=ecVision.*","title:=ecVision.*").Page("title:=ecVision Suite","name:=discussWin")._
frame("html id:=clientframe").webbutton("html id:=commonSearch"&MyButtons(Button)&"Btn").exist(1) Then
Exit For
End If 回复 4# Alvin-x
谢谢,为什么要加if来判断呢?
Environment("MyButtons")=browser("name:=ecVision.*","title:=ecVision.*").Page("title:=ecVision Suite","name:=discussWin")._
frame("html id:=clientframe","name:=clientframe").webbutton("html id:=commonSearch"&MyButtons(Button)&"Btn").exist
If Environment("MyButtons") Then
Reporter.ReportEvent 0, "Find Web Button", "Find the Button"&":"& MyButtons(Button)
else
Reporter.ReportEvent 1, "Find Web Button", "Can't find the Button" &":"& MyButtons(Button)
End If
我是这样来判断的,exist后面加一个时间有什么好处? 回复 5# 491623644
缩短判断时间
页:
[1]