51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2497|回复: 1
打印 上一主题 下一主题

[Robot] goto语句的问题

[复制链接]
  • TA的每日心情
    开心
    2015-5-5 13:21
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    跳转到指定楼层
    1#
    发表于 2006-5-23 20:09:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    如下是脚本,我goto到password:  ,运行不了,提示"playback in progress...waiting for window"
    '$Include "common.sbh"
    '$Include "dbOper.sbh"
    Sub Main
        Dim Result As Integer
       
        Dim vn_flag As Integer

        'Initially Recorded: 2006-5-23  16:50:26
        'Script Name: gsm_改号_3
        '弹出对话框的内容
        Dim Dialogstr As string
        '取操作员返回信息的数据串
        Dim Opernamestr As string
       
        '从数据库取出城市和受理点
        Dim arry_opername(1 To 2, 1 To 2)  As Variant
       
       '从数据库取出密码验证号码
        Dim  vs_service_id(1 To 2, 1 To 1)  As Variant
       
        '数据库表信息的返回状态
        Dim dbresult as long
       
        '密码
        Dim vs_password As string
       

        StartBrowser "http://172.20.24.5:9001", "WindowTag=WEBBrowser"
       
        Window SetContext, "Caption=输入网络密码", ""
       
        '获取操作员工号Opernamestr
        Result=SQAGetProperty("\;Type=Window;Caption=输入网络密码;\;Type=EditBox;Label=用户名(U)","Text",Opernamestr)
        if Result<>0 then
        SQALogMessage sqaFail,"取操作员返回信息失败","取返回信息!"
        'msgbox(Result)
        Exit Sub
        else
        SQALogMessage sqaPass,"操作员返回信息:"+Opernamestr,"认证通过!"
        end if
       
        PushButton Click, "Text=确定"
       
        '获取操作员的city_code,department
        dbresult=globalQuery("hbbus","unitele","lemontea","select city_code,department from bm_person_name_t where lower(account)= "+"'"+Opernamestr+"'",arry_opername)
        'msgbox(dbresult)
        if dbresult<0 then
        'msgbox(dbresult)
        SQALogMessage sqaFail,"连接数据库失败","连接数据库失败!"
        Exit Sub
        end if
       
        '调试语句,输出city_code,department
        'msgbox(arry_opername(1,1))'city_code
        'msgbox(arry_opername(2,1))'department
       
        '获取密码验证号码
       
        dbresult=globalQuery("hbbus","unitele","lemontea","select service_id,password from bb_service_relation_t where city_code="+arry_opername(1,1)+" and service_kind=9 and if_valid=1 and serving_status=1 and PRESERVE12=0 and preserve02<>3 and service_id not in ('13088990001','13304110026') and rownum=1",vs_service_id)
        'msgbox(dbresult)
        if dbresult<0 then
        'msgbox(dbresult)
        SQALogMessage sqaFail,"连接数据库失败","连接数据库失败!"
        Exit Sub
        else
        SQALogMessage sqaPass,"改号前号码:"+vs_service_id(1,1),"查询时弹出信息!"
        end if
       
        '调试语句,输出vs_service_id
        'msgbox(vs_service_id(1,1))'密码验证号码
        'msgbox(vs_service_id(2,1))'密码
       
        vs_password="888888"
        vn_flag=1
        Window SetContext, "WindowTag=WEBBrowser", ""
        Window WMaximize, "", ""

        Browser SetFrame,"Type=HTMLFrame;HTMLId=left_page",""
        Browser NewPage,"",""   
        HTML Click, "Type=HTML;HTMLId=GSM改号", "Coords=31,7"
        Browser SetFrame,"Type=HTMLFrame;HTMLId=right_page;\;Type=HTMLFrame;HTMLId=header",""
        Browser NewPage,"HTMLTitle=GSM改号;Index=0",""
        EditBox Click, "Type=EditBox;Name=TPhoneNumber", "Coords=22,7"
        InputKeys vs_service_id(1,1)
        EditBox Click, "Type=EditBox;Name=TPassword", "Coords=38,14"
        DelayFor (1000)
    password:   
        if vn_flag=1 then
        InputKeys "{BKSP}{BKSP}{BKSP}{BKSP}{BKSP}{BKSP}"
        end if
        InputKeys vs_password'"CQAAAKQAAABdVOtDjKE5HA0="
        PushButton Click, "Type=PushButton;Name=Bquery"
       
        'Window SetContext, "Caption=Microsoft Internet Explorer", ""
        'PushButton Click, "Text=确定"
       
        DelayFor (1000)
    refetch:
        Result=SQAGetProperty("\;Type=Window;Caption=Microsoft Internet Explorer;\;Type=Label;ObjectIndex=1","Text",Dialogstr)
        if Result=0 and instr(Dialogstr,"欠费")  then
            Window SetContext, "Caption=Microsoft Internet Explorer", ""
            PushButton Click, "Text=确定"  
            
            SQALogMessage sqaPass,"欠费验证通过!"+Dialogstr,"欠费验证通过!"
             goto refetch
         elseif Result=0 and instr(Dialogstr,"密码不正确")  then
         Window SetContext, "Caption=Microsoft Internet Explorer", ""
            PushButton Click, "Text=确定"  
         SQALogMessage sqaPass,"密码验证通过!"+Dialogstr,"密码验证通过!"
             
             vs_password=vs_service_id(2,1)
             goto password
         else
            SQALogMessage sqaFail,"密码验证不通过!","密码验证不通过!"
       
        end if
       
       
       
       

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

    使用道具 举报

  • TA的每日心情
    开心
    2015-5-5 13:21
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    2#
     楼主| 发表于 2006-5-24 07:26:34 | 只看该作者
    已经解决
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-11-10 16:44 , Processed in 0.075087 second(s), 27 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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