本人状态,进行时~going on!!

winrunner的基本操作

上一篇 / 下一篇  2008-09-09 18:01:25 / 个人分类:软件操作

(1),先在Winrunner里建一个脚本(这里以http://www.newtours.demoaut.com的订购飞机票为例)

(2),点击Record开始录制,

for (i=1; i<5; i++)
 
{
# Shell_TrayWnd
 set_window ("Shell_TrayWnd", 3);
 toolbar_button_press ("ToolbarWindow32_0_1", "启动 Internet Explorer 浏览器"); # Button Number 0;

# Browser Main Window
 set_window ("Browser Main Window", 29);
 list_select_item("browser_main_combo_location","http://www.newtours.demoaut.com");

# Welcome: Mercury Tours
 set_window("Welcome: Mercury Tours",11);
 edit_set("userName","pc8");
 obj_type("userName","<kTab>");
 password_edit_set("password","ca7121aa614993e5");
 obj_type("password","<kReturn_E>");
 web_image_click("login", 35, -52);

# Find a Flight: Mercury Tours:
 set_window("Find a Flight: Mercury Tours:",23);
 list_select_item("passCount",i);(把4改成变量i)
 web_image_click("findFlights", 55, 12);

# Select a Flight: Mercury Tours
 set_window("Select a Flight: Mercury Tours",3);
 web_image_click("reserveFlights", 62, 13);
switch (i) {
case"1":
 # Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst0","1");
 edit_set("passLast0","1");
 break;
 
 case"2":
 # Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst0","1");
 edit_set("passLast0","1");
 edit_set("passFirst1","2");
 edit_set("passLast1","2");
 break;
 
    case"3":
 # Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst0","1");
 edit_set("passLast0","1");
 edit_set("passFirst1","2");
 edit_set("passLast1","2");
 edit_set("passLast2","3");
 edit_set("passFirst2","3");
  break;
  
case"4":
# Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst0","1");
 edit_set("passLast0","1");
 edit_set("passFirst1","2");
 edit_set("passLast1","2");
 edit_set("passLast2","3");
 edit_set("passFirst2","3");
 edit_set("passFirst3","4");
 edit_set("passLast3","4");
 edit_set("creditnumber","123456");
 web_image_click("buyFlights", 57, 8);
 break;
 }
# Browser Main Window
 win_close ("Browser Main Window");
}

 

(3)加个for语句的变量,自动往下订购。

for (i=1; i<5; i++)
 
{
# Shell_TrayWnd
 set_window ("Shell_TrayWnd", 3);
 toolbar_button_press ("ToolbarWindow32_0_1", "启动 Internet Explorer 浏览器"); # Button Number 0;

# Browser Main Window
 set_window ("Browser Main Window", 29);
 list_select_item("browser_main_combo_location","http://www.newtours.demoaut.com");

# Welcome: Mercury Tours
 set_window("Welcome: Mercury Tours",11);
 edit_set("userName","pc8");
 obj_type("userName","<kTab>");
 password_edit_set("password","ca7121aa614993e5");
 obj_type("password","<kReturn_E>");
 web_image_click("login", 35, -52);

# Find a Flight: Mercury Tours:
 set_window("Find a Flight: Mercury Tours:",23);
 list_select_item("passCount",i);
 web_image_click("findFlights", 55, 12);

# Select a Flight: Mercury Tours
 set_window("Select a Flight: Mercury Tours",3);
 web_image_click("reserveFlights", 62, 13);

for (j=0; j<i; j++)

{
 # Book a Flight: Mercury Tours
 set_window("Book a Flight: Mercury Tours",5);
 edit_set("passFirst"&j,"1"&j);
 edit_set("passLast"&j,"1"&j);
 edit_set("creditnumber","123456");
 web_image_click("buyFlights", 57, 8);

 }
# Browser Main Window
 win_close ("Browser Main Window");
}


TAG: 软件操作

 

评分:0

我来说两句

日历

« 2024-05-09  
   1234
567891011
12131415161718
19202122232425
262728293031 

我的存档

数据统计

  • 访问量: 4511
  • 日志数: 8
  • 建立时间: 2008-09-09
  • 更新时间: 2008-09-18

RSS订阅

Open Toolbar