• qt测试脚本


     ' With Dialog("登录窗口")
    '   .WinEdit("用户名").Set DataTable("name", dtLocalSheet)
    '   .WinEdit("密码").SetSecure "48aaacb608d2ded49732d0cd2578c68ee5f42371"
    ''   .WinEdit("密码").Set DataTable("密码", dtLocalSheet)
    '   .WinButton("登录").Click
    ' End With
    '
    ' Set mywin = Dialog("登录窗口")
    ' mywin.WinEdit("用户名").Set "Mercury"
       
     Dim CountNum
     Dim n,p,Digmsg
     CountNum = DataTable.GetSheet("登录").GetRowCount

     For i=1 to CountNum
     ' 取出DataTable中的字段值:用户名、密码、用例名
      n = DataTable("用户名", dtLocalSheet)
      p =DataTable("密码", dtLocalSheet)
      caseName=DataTable("caseName",dtLocalSheet)
      
       Dialog("登录窗口").WinEdit("用户名").Set n
       Dialog("登录窗口").WinEdit("密码").Set p
       Dialog("登录窗口").WinButton("登录").Click
      
        If isDig Then
          Digmsg = ReturnDigMsg
          If  Digmsg =DataTable("预期结果", dtLocalSheet) Then
             QTP_Capture(caseName)
             CreateLog(Digmsg & " 与预期结果一致.")
             Dialog("登录窗口").Dialog("Flight Reservations").WinButton("确定").Click
    '         Dialog("登录窗口").Dialog("Flight Reservations").WinButton("text:=" & ok_text).Click
           DataTable.GetSheet("登录").SetNextRow   
           else
             Exit For
          End If
        End If
     Next

     Public function isDig()
        wait(2)
       isDig  = Dialog("登录窗口").Dialog("Flight Reservations").Exist(2)
     End Function

    '@Description 返回对话框文字 从Attached Text属性取值
     Public Function ReturnDigMsg()
      Dim MyWin
       Set  MyWin = dialog("登录窗口").Dialog("Flight Reservations")      
             ReturnDigMsg = MyWin.WinButton("text:=确定").GetROProperty("attached text")
    '    ReturnDigMsg = MyWin.WinButton("text:=" & ok_text).GetROProperty("attached text")
         End Function

    贴图:

         最终脚本:

     

    Dim userName
    Dim pwd
    Dim recordNum
    Dim strMsg
    Dim j


    Dialog("Select A System").AcxButton("OK").Click

    recordNum=DataTable.GetSheet("Action1").GetRowCount
    'msgBox "条数:" & recordNum  & "个"
    For i=0 to recordNum
     userName=DataTable("用户名",dtLocalSheet)
     pwd=DataTable("密码",dtLocalSheet)
    Dialog("User Login").WinEdit("User Name:").Set userName
    Dialog("User Login").WinEdit("User Name:").Type  micTab
    Dialog("User Login").WinEdit("Password:").Set pwd
    Dialog("User Login").WinEdit("Password:").Type  micTab
    Dialog("User Login").AcxButton("Login").Click
    'If   isDig Then
    strMsg=ReturnDigMsg
    If  strMsg=DataTable("预期结果",dtLocalSheet) Then  
      Dialog("User Login").Dialog("QOMO ARS").WinButton("确定").Click '''一次登陆
      DataTable.GetSheet("Action1").setNextRow
    Else
     Exit for
    'End if   end For
    'Next

    End If

    Next

    Public Function ReturnDigMsg()
      Dim MyWin
       Set  MyWin = dialog("User Login").Dialog("QOMO ARS")      
             ReturnDigMsg = MyWin.WinButton("确定").GetROProperty("attached text")
    '    ReturnDigMsg = MyWin.WinButton("text:=" & ok_text).GetROProperty("attached text")
         End Function

    'Public Function isDig()
       ' wait(2)
      ' isDig  = Dialog("Select A System").AcxButton("OK").Click)
     '  isDig=Dialog("Select A System").AcxButton("OK").Click
      ' End Function

    '很郁闷的事情是:竟然把循环的条件忘了。。导致一直在循环语句里面跳来跳去。造成不好的效果。。。狂晕。。。我太嫩了。。。

      

  • 相关阅读:
    解决is not a supported wheel on this platform-解决pip has no attribute pep425tags-解决网上旧教程不适用的问题
    语音信号实验1-基于时域分析技术的语音识别
    解决 ModuleNotFoundError: No module named 'pip'
    Typecho如何上传模板和插件
    获取图片的URL链接(Typecho修改背景图片等都需要URL链接)
    ubuntu云服务器安装anaconda+jupyter配置
    ORACLE用户密码过期啦
    关于Nacos启动报如下错:nacos no javac in (usr/lib/jvm-1.8.0)
    记录一次华为云服务器给根目录扩容
    记录一次NFS快照es集群索引备份
  • 原文地址:https://www.cnblogs.com/xianqingzh/p/1379486.html
Copyright © 2020-2023  润新知