QTP 自动化测试 之 Object.Exist()不起作用怎么办?
来源:互联网 发布:java hadoop 读取文件 编辑:程序博客网 时间:2024/05/29 03:45
有些对象用Object.Exist不起作用,因为是隐藏起来的所以用Object.Exist都是true
所以采用DOM里的currentStyle获取visibility来判断对象是否存在
1. update Obj_Exist(WaitSec)
2. Update OBJ_NOTExist
'------------------------------------------------------------------------------------------------------------------------
'Function Obj_Exist
'Description Obj_Exist
'Input WaitTime
'Output Obj_Exist
'------------------------------------------------------------------------------------------------------------------------
Function Obj_Exist(Parameter,Object)
On Error Resume Next
Err.Clear
visibleValue = Ucase(Cstr(Object.currentStyle.visibility)) 'Get the visibility value of the object
' Check if the object is not hidden and exist in <30> seconds.
StartTime = Time()
Do while visibleValue = "HIDDEN"
Wait(1)
visibleValue = Ucase(Cstr(Action_Object.Object.currentStyle.visibility))
FindObjectResult = Eval(Object & ".Exist(1)")
If FindObjectResult and visibleValue<>"HIDDEN" Then
Exit Do
End If
If CalculateTimeDuration(StartTime)>CInt(30) Then
Obj_Exist = "Error|" & FormatCurrentTime() & " Object not exist in " & WaitSec & " seconds. Error Number: "&Err.Number&" Error Description: "&Err.Description&"|"
Exit Function
End If
Loop
' Check if the object is not hidden and exist in <WaitSec> seconds.
If Err.Number = 0 Then
Obj_Exist = "Pass|" & FormatCurrentTime() & " Object is found successfully and visible.|"
Else
Obj_Exist = "Error|" & FormatCurrentTime() & " Unexpected Error occurred. Error: "&Err.Number&" Error Description: "&Err.Description&"|"
End If
End Function
'------------------------------------------------------------------------------------------------------------------------
'Function Check_OBJnotExist
'Description Check OBJnotExist
'Input Object string
'Output Check result
'------------------------------------------------------------------------------------------------------------------------
Function OBJ_NotExist(Parameter,Object)
On Error Resume Next
Err.Clear
FindObjectResult = False
FindObjectResult = Eval(Object&".Exist(1)")
If Err.Number <> 0 Then
OBJ_NotExist = "Failed|"&FormatCurrentTime()&" Unexpected error while FindObject. Error details: "&Err.description&"|"
Else
If FindObjectResult and UCase(Cstr(Action_Object.Object.currentStyle.visibility))<>"HIDDEN" Then
OBJ_NotExist = "Failed|" &FormatCurrentTime()&" Object still exists.|"
Else
OBJ_NotExist = "Pass|" &FormatCurrentTime()&" Object doesn't exist .|"
End If
End If
End Function
- QTP 自动化测试 之 Object.Exist()不起作用怎么办?
- QTP 自动化测试 之 SelectValuefromList
- QTP自动化测试之VBScript基础
- QTP自动化测试之VBScript对象
- QTP自动化测试之VBScript基础
- QTP自动化测试之VBScript对象
- QTP--自动化测试之--自动化玩网页游戏
- QTP-不止GUI自动化测试之Telnet自动化
- QTP-不止GUI自动化测试之Telnet自动化
- 【软件自动化测试-QTP实战技能 14】== 自动化测试思想之QTP登录脚本
- QTP自动化测试流程
- QTP自动化测试流程
- 自动化测试----QTP
- QTP自动化测试进阶
- QTP自动化测试实践
- QTP自动化测试实践
- QTP-自动化测试流程
- QTP自动化测试 [学习]
- Big Event in HDU(多重背包问题)
- WPF PasswordBox样式(占位符,清除按钮 )
- 【leetcode】【套路题】476. Number Complement
- iOS与Unity3D、Arkit框架混编
- prometheus获取Consul上注册的服务
- QTP 自动化测试 之 Object.Exist()不起作用怎么办?
- c#的ORM框架Grove Kit安装以及使用
- Java并发编程:volatile关键字解析
- 段错误
- HBase删除表
- putty windows上传文件到linux服务器 & 从linux服务器 下载文件到 windows
- echart3图表的实际应用与简单示例
- noip胡测之8.15(没有正解)
- maven 创建spring工程遇到的问题