DeviceReplay的某些方法运行时出现General run error的问题解决
2010-07-14 19:15
627 查看
Mercury.DeviceReplay对象用于模拟鼠标单击和移动,还有键盘输入等操作。使用方式一般是:
Set deviceReplay =
CreateObject( "Mercury.DeviceReplay" )
deviceReplay.MouseDown
100,200,1
但是在QTP中实际使用的时候,当执行一段时间之后,经常会出现“general
run error”的错误,最后发现问题实际上是测试中像素的移动通过参数来获取,但是某些时候传入的像素位置已经超出了屏幕大小,因而出错。
解决方法是在操作之前先对移动的位置进行判断,这个可以通过与屏幕的高度和宽度进行比对来判断,获取屏幕宽度和高度的代码是:
Set deviceReplay =
CreateObject( "Mercury.DeviceReplay" )
deviceReplay.MouseDown
100,200,1
但是在QTP中实际使用的时候,当执行一段时间之后,经常会出现“general
run error”的错误,最后发现问题实际上是测试中像素的移动通过参数来获取,但是某些时候传入的像素位置已经超出了屏幕大小,因而出错。
解决方法是在操作之前先对移动的位置进行判断,这个可以通过与屏幕的高度和宽度进行比对来判断,获取屏幕宽度和高度的代码是:
function ScreenPixel() Dim strComputer strComputer= "." Set objWMIService = GetObject("winmgmts:"& "{impersonationLevel=impersonate}!//"& strComputer & "/root/cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_DesktopMonitor") For Each objItem In colItems screenWidth=objItem.ScreenWidth screenHeight= objItem.ScreenHeight Next End function
相关文章推荐
- Xcode运行时,出现“xcode cannot run using the selected device”问题解决方法
- 解决Xcode中运行出现"cannot run using the selected device"、"cannot run on the selected destination"或无反应问题
- 在centos中运行java命令时出现Error: Could not find or load main class XXX问题的解决方法
- Eclipse运行Maven的SpringMVC项目Run on Server时出现错误:Error configuring application listener of class org.springframework.web.context.ContextLoaderListener的问题解决
- Ubuntu系统下运行Eclipse出现找不到jre的问题的解决方法
- AppFuse中运行setup,在webdoclet中出现OutOfMemoryError问题解决
- Ubuntu运行Chrome出现“Google Chrome can not be run as root”的解决方法
- mono-3.4.0 源码安装时出现的问题 [do-install] Error 2 [install-pcl-targets] Error 1 解决方法
- npm install命令运行中出现Error: ENOENT: no such file or directory解决方法
- Ubuntu系统下运行Eclipse出现找不到jre的问题的解决方法
- Win8.1下运行英雄联盟LOL出现不兼容蓝屏问题解决方法
- 运行yum时出现/var/run/yum.pid已被锁定,PID为xxxx的另一个程序正在运行的问题解决
- 解决 在Ubuntu上执行 $adb shell 出现 error:insufficient permissions for device 问题
- Ubuntu上运行Chrome出现“Google Chrome can not be run as root”错误的解决方法
- java web项目运行出现java.lang.NoSuchFieldError: deferredExpression解决方法!
- 检查运行IIS 5.1 使用出现server application error解决方法
- Delphi2010中使用DataSnap创建服务器时出现Socket Error# 10013的问题的解决方法
- VC++中出现的Error Spawning Cl.exe问题的解决方法
- 使用workbench运行更新语句时出现如下问题与解决方法。
- vs2008编译时出现问题解决方法:MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16