QTP+VM: Why is the Click command not executed when I'm not conncted to the VM via Remote Desktop?

StackOverflow https://stackoverflow.com/questions/1700380

  •  19-09-2019
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top