右键菜单操作自动测试

上一篇 / 下一篇  2008-11-13 13:35:54 / 个人分类:QTP

示例一:

rem 在一个页面的某链接上按右键
Browser("Google").Page("qwewqe - Google 搜索").Link("qwewqe 的博客空间联城网[免费发布信息][分类信息,信").Click micRightBtn

Dim wshShell
      Set wshShell = CreateObject("Wscrīpt.Shell")
'模拟键盘操作,向下移动两次
For i=1 to 2
wshShell.SendKeys "{DOWN}"   '模拟键盘操作
 Next
 '模拟键盘操作,按回车键,完成在新窗口中打开链接
   wshShell.SendKeys "{ENTER}" 


示例二:

rem  在Word中复制粘贴一段文字的右键操作
'选择需要复制的原文字,Drop后面的内容定义了文字块的坐标
Window("Microsoft Word").WinObject("Microsoft Word 文档").Drag 510,180
Window("Microsoft Word").WinObject("Microsoft Word 文档").Drop 645,178
'按右键
Window("Microsoft Word").WinObject("Microsoft Word 文档").Click 576, 182, micRightBtn

Dim wshShell
      Set wshShell = CreateObject("Wscrīpt.Shell")
'模拟键盘操作,向下移动两次
For i=1 to 2
wshShell.SendKeys "{DOWN}"   '模拟键盘操作
 Next
 '模拟键盘操作,按回车键,完成复制操作
wshShell.SendKeys "{ENTER}"   '模拟键盘操作


'在需要粘贴的位置按右键
Window("Microsoft Word").WinObject("Microsoft Word 文档").Click 393, 564, micRightBtn
'模拟键盘操作,在右键菜单上向下移动三次,按回车键,完成粘贴操作
For i=1 to 3
wshShell.SendKeys "{DOWN}"   '模拟键盘操作
 Next
wshShell.SendKeys "{ENTER}"   '模拟键盘操作

TAG: QTP 右键菜单

yocky 引用 删除 zxy_yocky   /   2009-03-04 19:38:34
ActiveX 部件不能创建对象: 'Wscrīpt.Shell'
刚刚接触QTP, 运行的时候提示这样的错误,请问应该如何处理?谢谢
 

评分:0

我来说两句

我的栏目

日历

« 2024-04-28  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 3186
  • 日志数: 5
  • 建立时间: 2008-10-25
  • 更新时间: 2008-11-19

RSS订阅

Open Toolbar