Raymondzfy 2008-4-4 11:14
拥有登录窗口的Delphi应该如何录制?
我公司开发的直放站网管系统主要是用delphi开发的,属于C/S 架构,进入该系统之前首先会有一个登录窗口,输入用户名和密码后才可进入系统主界面(标题为****直放站统一网管系统),
而该登录窗口是一个无标题的Dialog,每次录制时都会出错,提示“Window [Dialog]****直放站统一网管系统 was not found”
请问下各路高手,这种带有登录Dialog的程序该如何录制啊?
急。。。。。。。。。。。。。
jmy_1981 2008-4-7 16:06
lz看看Recorvery System可以帮到你吗?
如题。
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。
希望有帮助。
Raymondzfy 2008-4-16 19:42
楼上的可不可以给个例子啊?
jmy_1981 2008-4-18 16:38
ls我可以给你一些伪代码……
如题。
1. lz可以先激活login的窗口,然后录制login窗口的声明。
2. 在frame文件里面,找到一段关于login的const,wStartup。
// First window to appear when application is invoked
// const wStartup = ?
3. 取消const行的注释, 在用前面录制的窗口声明代替?
4. 定义invoke()函数,输入类似用户名、密码等数据。
/* Code Dummy */
window MainWin MyApp
tag "My App"
const wStartup = LOGIN //这里在先前录制的login窗口的声明叫LOGIN
Invoke () //加载Invoke () 函数
derived::Invoke ()
Login.Name.SetText ("name") //相关数据,如用户名
Login.Password.SetText ("password") //相关数据,如密码
Login.OK.Click ()
window DialogBox LOGIN //login窗口的声明
tag "Login"
PushButton OK
tag "OK"
/* End Code Dummy */
希望有帮助。
Raymondzfy 2008-4-23 21:58
回复 3# 的帖子
我的步骤如下:
1.Open Project->New Project 创建工程Flight Reservation
2.点击Enable Extensions,然后选择Flight Reservation程序后,点击OK,要求重新启动程序
3.重新启动程序后,点击Set Recovery System后,在Frame.inc中出现如下:
const wMainWindow = FlightReservation
window MainWin FlightReservation
multitag "Flight Reservation"
"$D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
// 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
window MainWin FlightReservation
multitag "Flight Reservation"
"$D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
// 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 = {?}
window DialogBox Login
tag "Login"
TextField AgentName1
multitag "Agent Name:"
"$3001"
TextField Password
multitag "Password:"
"$2000"
PushButton OK
multitag "OK"
"$1"
PushButton Cancel
multitag "Cancel"
"$2"
PushButton Help
multitag "Help"
"$2002"
StaticText AgentNameText
multitag "Agent Name:"
"$65535[1]"
StaticText PasswordText
multitag "Password:"
"$65535[2]"
CustomWin AgentName2
multitag "[BitMap]Agent Name:"
"[BitMap]$65535"
接下来点击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)