lz可以看help里面的Getting Started -> Understanding the Recorvery System -> How To -> Handling login windows in non-Web applications这章。
一般c/s结构的application,可以通过const wStartup = xxx,再外定义login窗口解决。但是,如果你如果你发现你每次的login装口都是变化的,那么你需要加一些通配符和表达式来帮助找到tag。
// The working directory of the application when it is invoked
const sDir = "D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app"
// The command line used to invoke the application
const sCmdLine = "D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe "
// The first window to appear when the application is invoked
// const wStartup = ?
[ ] // The list of windows the recovery system is to leave open
[ ] // const lwLeaveOpen = {?}
4.然后关闭Flight Reservation,重新启动该程序,出现登录窗口
5.点击Record->Windows Declarations对登录窗口录制声明,并未修改任何内容,直接点击Paste to Editor后,Frame.inc中出现如下Coding,我进行了修改,如下:
const wMainWindow = FlightReservation
// The working directory of the application when it is invoked
const sDir = "D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app"
// The command line used to invoke the application
const sCmdLine = "D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe "
// The first window to appear when the application is invoked
const wStartup = Login
Invoke()
derived::Invoke()
Login.AgentName.setText ("Raymond")
Login.Password.setText ("mercury")
Login.OK.Click()
[ ] // The list of windows the recovery system is to leave open
[ ] // const lwLeaveOpen = {?}
接下来点击Record Testcase,再点击“Start Recording”后,会不断出现登录对话框,会自动输入用户名和密码,就是录制不了脚本,
在登录对话框点击取消后,如下:
[ ] *** Error: Window '[DialogBox]Login' was not found
[ ] Occurred in FlightReservation.Invoke
[ ] Called from FlightReservation.Invoke at D:\Program Files\Borland\SilkTest\Projects\Flight Reservation\frame.inc(17)
[ ] Called from DefaultBaseState at defaults.inc(103)
[ ] Called from main at $ScriptMain(2)