问题
I use QTP 11.0. When i run a script and in between if computer gets locked, the script fails.Is there any workaround?
Thanks in advance...
回答1:
You must unlock the computer. QTP/UFT requires an "interactive" desktop session to do much of the automation, and the Windows OS behaves differently when it is locked.
A good way around this issue is to use Virtual Machines for your automation lab that always remain unlocked. Access security is then maintained by the host machine or the client software used to access the VM's.
回答2:
It might be a lazy way.. But actually it works.. Save the below code as vbs file and double clik on it before execution.
do
set w=createobject("Wscript.shell")
w.sendkeys "{NUMLOCK}"
wscript.sleep 5000
loop
It will simply press Numlock , until you stop the script.
回答3:
Yes, we have a solution for this! You can use some screen saver blocker to avoid this issue.... that would make your computer unlocked until/unless you terminate the blocker process.
You can download this type of tool from google itself! I have never used that for my projects, but heard that there is some option like this. So just have a try - good luck!
回答4:
I swear by Caffeine. Found here: http://www.zhornsoftware.co.uk/caffeine/ your PC will never be blocked or go to sleep again!
I have also noticed that when the screensaver goes active the screenshots are all black in the Results Viewer!
回答5:
We can change the settings from control panel "No Screen Saver and Computer Goes to Sleep to Never". Hope this will help you on your local machine.
来源:https://stackoverflow.com/questions/24698947/script-fails-when-the-computer-is-locked-qtp-11-0-is-there-any-workaround