-
WR---H I G H L E V E L T S L F U N C T I O N S-之二
2008-02-05 17:47:33
{
if ((version == NETSCAPE_40) || (version == NETSCAPE_45) || (version == NETSCAPE_404))
{
list_num = substr(attr_val,2);
list_get_item(list,list_num,attr_val);
}
}
}
else
rc = generic_get_info(TLIST, list, attr, attr_val);
save_report_info(old_report_name);
return(rc);
}
public function list_get_selected(list, out label, out item_index)
{
auto rc, version, org_time,old_report_name;
if (nargs() != 3)
return(report_param_msg());
get_report_info(old_report_name);
save_report_info("list_get_selected");
if (window_is_a_browser_or_frame())
{
version = GetWindowActiveBrowserVersion();
ns_dont_pop_wizard = TRUE;
org_time = getvar("timeout_msec");
set_msec_timeout_no_report(1000);
# setvar("timeout", 1);
rc = activate_and_get_function(TLIST,list, "_list_get_selected", 0, 2,
label, item_index);
# setvar("timeout", org_time);
set_msec_timeout_no_report(org_time);
ns_dont_pop_wizard = FALSE;
if (rc != E_OK)
{
if (rc == E_NOT_FOUND || rc ==E_NOT_UNIQUE)
scroll_current_win();
rc = activate_and_get_function(TLIST,list, "_list_get_selected", 0, 2,
label, item_index);
}
list_get_item(list,item_index,label);
}
else
rc = activate_and_get_function(TLIST,list, "_list_get_selected", 0, 2,
label, item_index);
save_report_info(old_report_name);
return(rc);
}
public function list_select_item(list, item, button, click_offset)
{
auto rc, version,number,org_time,w,h,old_report_name;
auto list_wait_time=0;
auto desc, dummy, msw_class_attr,hWnd,count;
auto win =GUI_get_window ( );
org_time = getvar("timeout_msec");
if (nargs() == 2){
button = LEFT;
click_offset = LIST_DEFAULT_CLICK_LOCATION;
}
else if (nargs() == 3)
click_offset = LIST_DEFAULT_CLICK_LOCATION;
else if (nargs() != 4)
return(report_param_msg());
get_report_info(old_report_name);
save_report_info("list_select_item");
if (window_is_a_browser_or_frame())
{
version = GetWindowActiveBrowserVersion();
ns_dont_pop_wizard = TRUE;
if ((version == NETSCAPE_40) || (version == NETSCAPE_45) || (version == NETSCAPE_404))
list_wait_time=1;·#
# Bring window to front.
rc = win_get_info(win,"handle",hWnd);
SetFgWindow(hWnd);
if ( (item == "") && ((version == NETSCAPE_40) || (version == NETSCAPE_45) ||
(version == NETSCAPE_404) || (version == IE_4) || (version == NS_61)) )
{
rc = list_get_items_count(list, count);
if (rc != E_OK)
return (rc);
# convert to zero base
count--;
count = "#" & count;
rc = list_deselect_range(list,"#0",count);
save_report_info(old_report_name);
return(rc);
}
if ((version == NETSCAPE_40) || (version == NETSCAPE_45) || (version == NETSCAPE_404) )
{
if (list == BROWSER_COMBO_LOCATION_CLASS) ## let WinRunner play on browser_combo_location
{
rc = obj_get_info(list,"handle",hWnd);
rc = web_main_combo_get_item_num(list, hWnd, item, number);
if (rc == E_OK)
item = "#" & number;
}
else
{
if (match (item, "[ ]*#[0-9][0-9]*") != 1)
{
rc = list_get_item_num(list, item, number);
if (rc == E_OK)
item = "#" & number;
}
}
}
else if (version == IE_4)
{
# GUI_map_get_desc (win, list, desc, dummy );
# if ((GUI_desc_get_attr(desc, MSW_CLASS, msw_class_attr) == E_OK)
if ((obj_get_info(list,MSW_CLASS, msw_class_attr) == E_OK)
&& (msw_class_attr == BROWSER_COMBO_LOCATION_CLASS))
{
rc = obj_get_info(list,"handle",hWnd);
rc = web_main_combo_get_item_num(list, hWnd, item, number);
if (rc == E_OK)
{
item = "#" & number;
}
else
{
### we force the web_main_combo to open so the list will be refresh.
### appearently a bug in the IE that cause the count to be 0 if list wasn't open at least once.
obj_get_info(list,"width",w);
obj_get_info(list,"height",h);
obj_mouse_click(list,w-5,h-5,LEFT);
rc = web_main_combo_get_item_num(list, hWnd, item, number);
if (rc == E_OK)
{
item = "#" & number;
}
WR---H I G H L E V E L T S L F U N C T I O N S-之一
2008-02-05 16:57:17
#####################################################################
#
# WEBTEST WR_FUNCS - H I G H L E V E L T S L F U N C T I O N S
#
#####################################################################
static marked_window = "", marked_object = "", ret_value = 0, func_name = "";
static args_part = "", arg1 = "", arg2 = "", arg3 = "", arg4 = "", arg5 = "";
static arg6 = "", arg7 = "", arg8 = "", arg9 = "", arg10 = "", arg11 = "";
static arg12 = "", hl_func_name = "", test_name = "", line_number = "";
static stop_flag = 1;
public function list_activate_item(list, item, click_offset)
{
auto rc, version, org_time,old_report_name;
if (nargs() == 2)
click_offset = LIST_DEFAULT_CLICK_LOCATION;
else if (nargs() != 3)
return(report_param_msg());
get_report_info(old_report_name);
save_report_info("list_activate_item");
if (window_is_a_browser_or_frame())
{
version = GetWindowActiveBrowserVersion();
ns_dont_pop_wizard = TRUE;
org_time = getvar("timeout_msec");
set_msec_timeout_no_report(1000);
# setvar("timeout", 1);
rc = activate_function(TLIST, list, "_list_activate_item", item, click_offset);
set_msec_timeout_no_report(org_time);
# setvar("timeout", org_time);
ns_dont_pop_wizard = FALSE;
if (rc != E_OK)
{
if (rc == E_NOT_FOUND || rc ==E_NOT_UNIQUE)
scroll_current_win();
rc = activate_function(TLIST, list, "_list_activate_item", item, click_offset);
}
}
else
rc = activate_function(TLIST, list, "_list_activate_item", item, click_offset);
save_report_info(old_report_name);
return(rc);
}
public function list_get_item(list, item, out label)
{
auto rc = E_GENERAL_ERROR , version,i;
auto timeout,old_report_name;
web_get_timeout(timeout);
if (nargs() != 3)
return(report_param_msg());
get_report_info(old_report_name);
save_report_info("list_get_item");
if(item < 0)
{
save_report_info(old_report_name);
return(E_OUT_OF_RANGE);
}
if (window_is_a_browser_or_frame())
{
version = GetWindowActiveBrowserVersion();
ns_dont_pop_wizard = TRUE;
if (version == IE_4) {
if (is_IE4_html_msw_class(list) != E_OK) {
rc = activate_and_get_function(TLIST, list, "_list_get_item", 1, 1,
item, label);
## on lists on IE_4 that are not HTML_LISTBOX don't try to call web_list_get_item_num - give it to WR
}
}
if (rc != E_OK) {
for (i=0;i<timeout;i++)
{
rc = activate_and_get_function(TLIST, list, "web_list_get_num_item", 1, 1, item,
label);
if (rc == E_AREA_OUT)
set_window(GUI_get_window(),1);
else
break;
}
}
ns_dont_pop_wizard = FALSE;
if (rc != E_OK) {
if (rc == E_NOT_FOUND || rc ==E_NOT_UNIQUE)
scroll_current_win();
rc = activate_and_get_function(TLIST, list, "web_list_get_item_num", 1, 1, item,
label);
}
}
else
rc = activate_and_get_function(TLIST, list, "_list_get_item", 1, 1,
item, label);
save_report_info(old_report_name);
return(rc);
}
public function list_get_item_num(list, item, out item_num)
{
auto rc = E_GENERAL_ERROR , version, i,old_report_name;
auto timeout;
web_get_timeout(timeout);
if (nargs() != 3)
return(report_param_msg());
get_report_info(old_report_name);
save_report_info("list_get_item_num");
if (window_is_a_browser_or_frame())
{
version = GetWindowActiveBrowserVersion();
ns_dont_pop_wizard = TRUE;
if (version == IE_4) {
if (is_IE4_html_msw_class(list) != E_OK) {
rc = activate_and_get_function(TLIST, list, "_list_get_item_num", 1, 1,
item, item_num);
## on lists on IE_4 that are not HTML_LISTBOX don't try to call web_list_get_item_num - give it to WR
}
}
if (rc!=E_OK) {
for (i=0;i<timeout;i++)
{
rc = activate_and_get_function( TLIST, list, "web_list_get_item_num", 1, 1 ,
item, item_num);
if (rc == E_AREA_OUT)
set_window(GUI_get_window(),1);
else
break;
}
}
ns_dont_pop_wizard = FALSE;
if ((rc != E_OK) && (rc != E_STR_NOT_FOUND))
{
if (rc == E_NOT_FOUND || rc == E_NOT_UNIQUE)
scroll_current_win();
rc = activate_and_get_function(TLIST, list, "web_list_get_item_num", 1, 1,
item, item_num);
}
}
else
rc = activate_and_get_function(TLIST, list, "_list_get_item_num", 1, 1,
item, item_num);
save_report_info(old_report_name);
return(rc);
}
public function list_get_items_count(list, out count)
{
auto rc,old_report_name, version, org_time;
if (nargs() != 2)
return(report_param_msg());
get_report_info(old_report_name);
save_report_info("list_get_items_count");
if (window_is_a_browser_or_frame())
{
version = GetWindowActiveBrowserVersion();
ns_dont_pop_wizard = TRUE;
org_time = getvar("timeout_msec");
set_msec_timeout_no_report(1000);
# setvar("timeout", 1);
rc = activate_and_get_function(TLIST, list, "_list_get_items_count", 0, 1,
count);
# setvar("timeout", org_time);
set_msec_timeout_no_report(org_time);
ns_dont_pop_wizard = FALSE;
if (rc != E_OK)
{
if (rc == E_NOT_FOUND || rc ==E_NOT_UNIQUE)
scroll_current_win();
rc = activate_and_get_function(TLIST, list, "_list_get_items_count", 0, 1,
count);
}
}
else
rc = activate_and_get_function(TLIST, list, "_list_get_items_count", 0, 1,
count);
save_report_info(old_report_name);
return(rc);
}
public function list_get_info(list, attr, out attr_val)
{
auto rc, version, list_num,old_report_name;
if (nargs() != 3)
return(report_param_msg());
get_report_info(old_report_name);
save_report_info("list_get_info");
if (window_is_a_browser_or_frame())
{
version = GetWindowActiveBrowserVersion();
ns_dont_pop_wizard = TRUE;
rc = generic_get_info(TLIST, list, attr, attr_val);
ns_dont_pop_wizard = FALSE;
if (rc != E_OK)
{
if (rc == E_NOT_FOUND || rc ==E_NOT_UNIQUE)
scroll_current_win();
rc = generic_get_info(TLIST, list, attr, attr_val);
}
if (attr == "value"<SPAN lang=EN-US style="FONT-SIZE: 10pt; COLOR: black; FONT-FAQQ简单脚本
2008-02-05 16:39:11
table = "f:\\wrtest\\qq-test\\qq-test.xls";
rc = ddt_open(table, DDT_MODE_READ);
if (rc!= E_OK && rc != E_FILE_OPEN)
pause("Cannot open table.");
ddt_get_row_count(table,table_RowCount);
for(table_Row = 1; table_Row <= table_RowCount; table_Row ++)
{
ddt_set_row(table,table_Row);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
button_press ("开始");
# BaseBar
set_window ("BaseBar", 9);
toolbar_select_item ("ToolbarWindow32_1", "程序(P);腾讯软件;腾讯QQ");
# QQ用户登录
set_window ("QQ用户登录", 10);
edit_set ("Edit", ddt_val(table,"qq_name"));
password_edit_set("Edit_1", ddt_val(table,"qq_password"));
#judge QQ window whether is find
if(win_exists("<No title>",7)==E_NOT_FOUND)
{
report_msg("QQ window isn't found Now!");
set_window("QQ登录",2);
button_press("返回"); #关闭QQ登录验证窗口
win_close("QQ用户登录"); #关闭QQ用户登录窗口
}
else
{
# <No title>
win_move ("<No title>", 658, 0);
win_mouse_click ("<No title>", 194, 12);
}
}
ddt_close(table);
标题搜索
我的存档
数据统计
- 访问量: 28017
- 日志数: 33
- 建立时间: 2007-11-22
- 更新时间: 2009-12-03