QTP+VM:当我未通过远程桌面连接到虚拟机时,为什么不执行单击命令?

发布于 2024-08-10 18:15:20 字数 285 浏览 15 评论 0原文

我将 QTP 10 与 VMWare 一起使用来测试 Siebel 应用程序。 我正在执行以下代码来单击“保存”按钮。

Browser("Siebel").Dialog("Filedownload").WinButton("Save").Click

当我通过远程桌面连接到虚拟机时,代码运行得非常好。

另一方面,当我通过调度程序启动 QTP 测试时,没有远程桌面连接,上面的代码失败,没有任何错误消息。 WinButton 根本没有被单击。

有什么想法吗?

I'm using QTP 10 together with VMWare to test a Siebel Application.
I'm executing the following code to click on a Save button.

Browser("Siebel").Dialog("Filedownload").WinButton("Save").Click

The code works perfectly fine when I'm connected to the VM via Remote Desktop.

On the other side, when I'm starting the QTP test through the scheduler, without having a Remote Desktop connection, the code above fails without any error message. The WinButton is simply not clicked.

Any idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无所的.畏惧 2024-08-17 18:15:20

只是根据我的经验补充一下。

在我工作的一些公司中,由于安全政策的原因,我无法更改屏幕保护程序或待机设置。一台电脑在长时间同步期间(例如生成非常大的报告)打开屏幕保护程序,并且执行被破坏。

为了避免这种情况,我创建了简单的“反睡眠”功能,每 5 分钟稍微“移动”一次鼠标。
http://automation-beyond.com/2009/08/18 /anti-sleep-function/

Private Const SleepTime_Max = 300 ‘ 5 minutes
Public Function AntiSleep()
Dim iter
Dim objTimer
Dim objDeviceReplay
Dim intTimeElapsed

 Set objTimer = MercuryTimers(“AntiSleep”)
 intTimeElapsed = CInt(objTimer.ElapsedTime/1000)

 If intTimeElapsed = 0 Then
  MercuryTimers(“AntiSleep”).Start
  Exit Function
 End If

 If intTimeElapsed < SleepTime_Max Then
  Exit Function
 End If

Set objDeviceReplay = CreateObject(“Mercury.DeviceReplay”)

 For iter = 100 To 110
   objDeviceReplay.MouseMove iter,300
 Next

MercuryTimers(“AntiSleep”).Start

Set objDeviceReplay = Nothing

End Function

在自定义同步函数中使用它的示例:
http://automation-beyond.com/2009 /08/20/gui-object-synchronization-custom-function/

谢谢,
阿尔伯特·加里耶夫

Just to add from my experience.

In some companies I worked for I couldn't change screensaver or standby settings due to security policy. A PC was bringing up screensaver during long synchronization periods (like generating really big report), and execution was broken.

To avoid that I created simple "Anti Sleep" function that slightly "moves" mouse every 5 minutes.
http://automation-beyond.com/2009/08/18/anti-sleep-function/

Private Const SleepTime_Max = 300 ‘ 5 minutes
Public Function AntiSleep()
Dim iter
Dim objTimer
Dim objDeviceReplay
Dim intTimeElapsed

 Set objTimer = MercuryTimers(“AntiSleep”)
 intTimeElapsed = CInt(objTimer.ElapsedTime/1000)

 If intTimeElapsed = 0 Then
  MercuryTimers(“AntiSleep”).Start
  Exit Function
 End If

 If intTimeElapsed < SleepTime_Max Then
  Exit Function
 End If

Set objDeviceReplay = CreateObject(“Mercury.DeviceReplay”)

 For iter = 100 To 110
   objDeviceReplay.MouseMove iter,300
 Next

MercuryTimers(“AntiSleep”).Start

Set objDeviceReplay = Nothing

End Function

Example of using it in a custom synchronization function:
http://automation-beyond.com/2009/08/20/gui-object-synchronization-custom-function/

Thank you,
Albert Gareev

依 靠 2024-08-17 18:15:20

QTP 无法与锁定的桌面交互,这就是为什么它仅在本地或通过 RDP 交互式登录时才适用。这是 QTP 的一个众所周知的限制,大多数自动化工程师在某些时候都经历过这种痛苦。 :)

更具体地说,它不能与 Win32 对象交互(想不出更好的表达方式),因此它可以与锁定桌面上的基本浏览器控件交互,没有问题,但浏览器弹出窗口和 Windows在这些情况下无法与应用程序进行交互。

我强烈建议(如果您的系统策略允许)您安装 UltraVNC 之类的东西或其他 VNC 变体来与您的远程机器。这样您就可以让远程计算机的桌面始终处于登录状态并处于活动状态。因为它是一个虚拟机,也不应该给您带来任何重大的安全问题。确保关闭所有屏幕保护程序并且不要自动锁定桌面。如果你这样做的话,QTP 应该会很适合你。

QTP can't interact with a locked desktop, that's why it'll only work for you when logged in interactively either locally or over RDP. It's a well known limitation of QTP, most automation engineers go through this pain at some point. :)

To be more specific, it can't interact with Win32 objects (can't think of a better way of putting it), so it'll interact with basic browser controls on a locked desktop no problem, but browser popups and Windows applications can't be interacted with in those circumstances.

I strongly recommend (if your system policy allows) that you install something like UltraVNC or another VNC variant to interact with your remote machines. That way you can leave the remote machine's desktop logged on and active at all times. Since it's a VM that shouldn't cause you any major security problems either. Make sure you turn off any screen savers and don't auto-lock the desktop too. QTP should work just fine for you if you do that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文