51Testing软件测试论坛

标题: QTP是否能实现对鼠标悬停提示信息的检查 [打印本页]

作者: skisky    时间: 2008-7-31 10:59
标题: QTP是否能实现对鼠标悬停提示信息的检查
C/S系统,工具栏,鼠标移到每一个工具上会出现一个tip提示信息,使用QTP能否实现对该提示信息的检查,希望得到高手的提示,谢谢!
作者: zte_boy    时间: 2008-7-31 11:07
可以采用FireEvent事件,具体的方法你可以去看下QTP的帮助
作者: zte_boy    时间: 2008-7-31 11:10
给你个实例参考
Option Explicit
'定义变量
Dim oWin32    'win32对象
Dim sTitle    '页面标题
Dim arrLinkText    '链接文字数组
Dim sLinkText    '链接文字
Dim sEventName    '操作事件名称
Dim iWaitTime    '两次操作时间间隔
Dim iIdentifyTimeOut    '识别对象超时时间
Dim n    '循环变量

Main

Sub Main
Set oWin32 = CreateObject("wscrīpt.shell")
sTitle = "中国雅虎.*"
arrLinkText = split("站长天下;今日焦点;邮箱;建站;彩票;空间;群组;相册",";",-1,1)    '定义链接文字数组
sEventName = "onmouseover"    '鼠标移到对象上的事件
iWaitTime = 1    '操作等待1秒
iIdentifyTimeOut = 3    '识别对象存在性超时时间设置为3秒

oWin32.Run("http://cn.yahoo.com/")    '打开浏览器,进入中国雅虎首页

For n=0 to ubound(arrLinkText)
  Wait iWaitTime    '操作等待
  sLinkText = arrLinkText(n)    '从链接文字数组中取出链接文字
  moveMouseOnIt    '调用操作时间函数
Next

Browser("title:="&sTitle).Close    '执行完毕关闭浏览器
End Sub

Function moveMouseOnIt()
'检查链接是否存在,存在则触发事件
If Browser("title:="&sTitle).page("title:="&sTitle).link("innertext:="&sLinkText,"index:=0").Exist(iIdentifyTimeOut) Then
  Browser("title:="&sTitle).page("title:="&sTitle).link("innertext:="&sLinkText,"index:=0").FireEvent sEventName   
  moveMouseOnIt = True
  Reporter.ReportEvent micPass,sEventName,"Trigger the event """&sEventName&""" successfully."
Else
  moveMouseOnIt = False
  Reporter.ReportEvent micFail,sEventName,"Fail to trigger the event """&sEventName&""" because of the absence of the link."
End If
End Function
作者: skisky    时间: 2008-7-31 11:11
FireEvent事件只针对web对象吧,还有就是鼠标放上去以后qtp如何捕获显示的tip呢?
作者: hbycyf123    时间: 2012-9-12 20:30
同问!
作者: 秦菲    时间: 2013-3-18 16:00
同问
作者: zhangkun90    时间: 2013-3-19 13:48
可以 在qtp11 中 点击 tools-web event recording configuration  中给变成high  试试




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