51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2366|回复: 5
打印 上一主题 下一主题

[求助] QTP检查WEBbutton是否存在

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2013-6-20 11:07:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. Dim MyButtons,Button
  2. MyButtons=array("Search","Reset")
  3. For Button=0 to ubound(MyButtons)
  4. Environment("MyButtons")=browser("name:=ecVision.*","title:=ecVision.*").Page("title:=ecVision Suite","name:=discussWin")._
  5. frame("html id:=clientframe").webbutton("html id:=commonSearch"&MyButtons(Button)&"Btn").exist
复制代码


代码如上,在检查webbutton时是否存在时,QTP检查一直不存在,实际程序已经跳转到该页面,该button实际存在
附上button属性

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

  • TA的每日心情
    无聊
    2020-12-8 11:20
  • 签到天数: 605 天

    连续签到: 1 天

    [LV.9]测试副司令

    2#
    发表于 2013-6-20 11:34:38 | 只看该作者
    对象库里都这些对象了为何还要用描述性编程,自己增加难度?而且你还描述错了。。。。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    3#
     楼主| 发表于 2013-6-20 13:36:39 | 只看该作者
    回复 2# joykao


        哪个地方描述错了,可以指出么?
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    4#
    发表于 2013-6-20 14:17:13 | 只看该作者
    1. Dim MyButtons,Button
    2. MyButtons=array("Search","Reset")
    3. For Button=0 to ubound(MyButtons)
    4.   If browser("name:=ecVision.*","title:=ecVision.*").Page("title:=ecVision Suite","name:=discussWin")._
    5. frame("html id:=clientframe").webbutton("html id:=commonSearch"&MyButtons(Button)&"Btn").exist(1) Then
    6. Exit For
    7. End If
    复制代码
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    5#
     楼主| 发表于 2013-6-20 14:32:05 | 只看该作者
    回复 4# Alvin-x
    谢谢,为什么要加if来判断呢?
    1. Environment("MyButtons")=browser("name:=ecVision.*","title:=ecVision.*").Page("title:=ecVision Suite","name:=discussWin")._
    2. frame("html id:=clientframe","name:=clientframe").webbutton("html id:=commonSearch"&MyButtons(Button)&"Btn").exist
    3. If Environment("MyButtons") Then
    4. Reporter.ReportEvent 0, "Find Web Button", "Find the Button"&":"& MyButtons(Button)
    5. else
    6. Reporter.ReportEvent 1, "Find Web Button", "Can't find the Button" &":"& MyButtons(Button)
    7. End If
    复制代码

    我是这样来判断的,exist后面加一个时间有什么好处?
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    无聊
    2018-9-27 10:05
  • 签到天数: 36 天

    连续签到: 1 天

    [LV.5]测试团长

    6#
    发表于 2013-6-20 16:06:09 | 只看该作者
    回复 5# 491623644


        缩短判断时间
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-21 01:54 , Processed in 0.079314 second(s), 28 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表