附件:一个完整的例子
#脚本名称:DateCheck
#创建人:谢慧强
#创建日期:2002/09/08
#功能:检查FLIGHTA 程序在输入错误月份的时候提示是否正确
#运行前要求:要求FLIGHA 进入定票窗口(New_Order 状态)且无任何数据输入
# 或者FLIGHTA 没有运行,这时候要求FLIGHTA。EXE 位
# 于E:\\Program Files\\Mercury
Interactive\\WinRunner\\samples\\flight\\app\\flight1a.exe
#参考文档:无
#修改历史:
# 修改人:谢慧强
# 修改 http://www.csai.cn 2002/09/09
# 主要修改内容:不采用位图方式,改为直接判断字符串内容
#load gui file
#Flight Reservation
if (GUI_load(".\\DateCheck.gui")!=0)
{
report_msg ("DataCheck:Can't load .\\DateCheck.gui");
texit;
}
#Check windows exists ,if don't exist ,call login to open it.
# Flight Reservation
if (win_exists("Flight Reservation")!=E_OK){
#pause ("Windows Flight Reservation don't exist");
#texit;
call "..\\login\\login"();
}
#input error month
win_activate ("Flight Reservation");
set_window ("Flight Reservation", 3);
obj_mouse_drag ("Button_4", 17, 6, 17, 7, LEFT);
obj_type ("MSMaskWndClass","301212");
list_select_item ("Fly From:", "Denver"); # Item Number 0;
#check message bitmap
# Flight Reservations_1
set_window ("Flight Reservations", 3);
#2002/09/09 谢慧强
#if ( win_check_bitmap("Flight Reservations", "Img1", 1)!=E_OK)
#static_check_info("Invalid month Entered.The month must be greater than 01 and less than
12.(static)","enabled",1);
if (static_check_info("CheckMessage","label","Invalid month Entered.The month must be
greater than 01 and less than 12.")!=E_OK)
#2002/09/09 谢慧强修改结束
{
report_msg("DateCheck:月份输入错误提示不对!");
}
button_press ("确定");
#close gui file
GUI_close(".\\DateCheck.gui");
文章来源于领测软件测试网 https://www.ltesting.net/