在lock机器上能运行脚本吗

部分可以, 需要注意以下几点:

1.QTP may not be able to identify objects. Though it would still be able to identify all web objects.

2.Any screenshots capture using CaptureBitmap will give a black screen.

3.QTP will fail on performing actions on non-web object.

4.It will also fail on web objects if the ReplayType setting is configured to mouse.

5.QTP test result summary will also show a warning that test was run on a locked machine. But we can disable this fron registry by setting a the value of SkipEnvironmentChecks to 1.

The Registry path is:

HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest

 

To perform operations on Windows objects when the machine is locked, we can't use the usual methods. In such a case we can rely on using the Windows messaging architecture. We can find the handle of the object we want to work on and send the appropriate message to it.

Consider the below code which sends a click event to a Button

  Const BM_CLICK = &HF5

  hwnd=Window("Explorer").WinButton("OK").GetROProperty("hwnd")

  'Send the click event to the button

  IResult = extern.PostMessage(Hwnd, BM_CLICK, 0, 0)

 

posted @ 2012-09-02 21:41  dushuai  阅读(114)  评论(0编辑  收藏  举报