51Testing软件测试论坛

标题: 自动测试过程中“忙窗体”的处理方法 New! [打印本页]

作者: yuxueqin    时间: 2008-2-22 11:43
标题: 自动测试过程中“忙窗体”的处理方法 New!
如果手动制造一个忙窗体,然后再跑以下脚本时,没问题。但如果重新开始跑全部的脚本,然后到出现忙窗体时,就获取不到该忙窗体的属性值了。请教各位高手了,谢谢!测试工具是:Rational Robot
Dim Result As Integer,StateString As String,temp as integer
    On Error Resume Next
    DelayFor 3000   '主动延时3秒
    call pWriteLog("调用了Sub Change()")
    for temp = 1 to 5
        Result = SqaFindObject("\;Type=Window;Caption=忙窗体")
        if Result = 0 then
            goto lCloseWindow
        end if
    next
    if Result <> 0 then
        call pWriteLog("没有出现忙窗体!,result=" & result)
    end if
lCloseWindow:
    Do While (Result = 0)
        call pWriteLog("出现了'服务器忙,请稍后再试'忙窗体")
        Window SetContext,"Caption=忙窗体",""
        InputKeys "{ENTER}"
        Delayfor 5000
        Result = SqaFindObject("\;Type=Window;Caption=Caption=忙窗体")
        If Result <> 0 Then
            call pWriteLog("成功关上了忙窗体...")
            Exit Do
        End If
    Loop

[ 本帖最后由 yuxueqin 于 2008-2-22 12:19 编辑 ]




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2