关闭

编写图片空间QTP脚本时的一点经验

发表于:2009-6-17 11:02

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:luozhongtao    来源:Taobao QA Team

  经验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

22/2<12
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号