QTP实现:
‘———–about——————
‘ @funcname:Common_MicRightMouse
‘ @brief: QTP右击鼠标选择菜单并回车
‘ @param:obj:具体的操作对象; rows:第几行菜单;
‘ @rtnval:无
‘ @register:无
‘ @register方式:无
Public Function Common_MicRightMouse(obj,rows)
’set obj= Browser(”浏览器”).Page(”member/login_登录页面”).WebElement(”登录页面空白处”)
‘拿到环境变量配置文件
cur_replay_type = Setting.WebPackage(”ReplayType”)
‘修改类型为鼠标右击
Setting.WebPackage(”ReplayType”) = 2
‘执行右击操作
obj.Click 123, 63,micRightBtn
‘环境变更还原
Setting.WebPackage(”ReplayType”) = cur_replay_type
idx=rows
‘模拟键盘操作
Set keys_test=createobject(”wscript.shell”)
‘通过循环语句,查找右击菜单的位置
For i = 1 To idx
keys_test.sendkeys “{down}”
NEXT
‘并回车
keys_test.sendkeys “{enter}”
‘退出操作
Set keys_test = nothin