经验3:通过CURRENTSYTLE判别LINK对象可用性
提供两种思路:
第一种方式:
V=strcomp(browser(”图片空间“).Page(”图片空间“).Link(”name:=下移“,”index:=5″).GetROProperty(”class”), “move-down J_TagMoveDown no-move-down”,1) If v=0 Then reporter.ReportEvent micPass,”pass”,”提示成功“ else reporter.ReportEvent micFail,”fail”,”提示失败“ End If |
第二种方式:
set my_obj =browser(”图片空间“).Page(”图片空间“).Link(”name:=下移“,”index:=5″).object x= my_obj.currentstyle.getattribute(”cursor”) y=”not-allowed” v=strcomp(x,y,1) If v=0 Then reporter.ReportEvent micPass,”pass”,”提示成功“ else reporter.ReportEvent micFail,”fail”,”提示失败“ End If |
经验4:通过DESCRIPTION访问对象库中同一对象运行时动态对象中静态提示文本
在页面中经常出现的DIALOG对象,在同一页面中可能会出现很多不同的DIALOG,但是读取对象时只有一个对象,但是其中静态文本,却是动态生成的,不同的操作对应不同的提示,此时通过:Static(”text:=图片标题不能超过50字符“).Exist语句判断系统是否成功操作!
Set MyDescription = Description.Create() MyDescription(”text”).Value = “此分类为系统分类,不可删除。" |
在这里的VALUE我们可以根据不同的对话框设置不同的静态文本:
If browser(”图片空间“).Dialog(”Windows Internet Explorer”).Static(MyDescription).Exist then reporter.ReportEvent micPass,”pass”,”删除系统分类时提示成功“ browser(”图片空间“).Dialog(”Windows Internet Explorer”).WinButton(”确定“).Click else reporter.ReportEvent micFail,”fail”,”删除系统分类时提示失败“ End If Set MyDescription = Nothing |
也可以采取这种方式:
If browser(”图片空间“).Dialog(”Windows Internet Explorer”).Static(”text:=图片标题不能超过50字符“).Exist Then reporter.ReportEvent micPass,”pass”,”图片标题不能超过50字符提示成功“ browser(”图片空间“).Dialog(”Windows Internet Explorer”).WinButton(”确定“).Click else reporter.ReportEvent micFail,”fail”,”图片标题不能超过50字符提示失败“ End If |