关于 web_reg_save_param 的问题
环境 LoadRunder9.51, Windows xp sp3场景:
页面上有一个DealerID的Textbox,并且有新增和修改按钮
点新增按钮以后,系统会将新增的DealerID传回到页面,
点修改的时候,系统回根据Textbox的值,修改刚增加的Dealer
回放时候增加客户成功Server response截图
脚本
lr_end_transaction("add", LR_AUTO);
lr_start_transaction("modify");
lr_think_time(20);
web_reg_save_param("DealerID",
"LB=<input name=\"txtDealerID\" type=\"text\" value=\"",
"RB=\" id=\"txtDealerID\" />",
LAST );
lr_log_message("Dealer ID is : %s",lr_eval_string ("{DealerID}"));
generator Log
Action.c(88): web_reg_save_param started
Action.c(88): Registering web_reg_save_param was successful
Action.c(93): Warning: The string 'DealerID' with parameter delimiters is not a parameter.
Dealer ID is : {DealerID}
提示是注册成功,但是,我打印的时候,报错,不是一个参数
并且修改Dealer不能成功,因为DealerID取不到
请问下是为什么
问题1:
这么写 web_reg_save_param 是否正确
问题2:
如果想查看DealerID的值,有什么好办法
问题3:
参数的用法
"Name=txtDealerID", "Value={DealerID}", ENDITEM,
是否正确,谢谢 顶一下 web_reg_save_param 不是成功了么,你用的lr_log_message 放的位置不太对吧
回复 3# 的帖子
Action(){
/* Registering parameter(s) from source task id 5
// {Siebel_Analytic_ViewState4} = "/=="
// */
web_add_auto_header("Accept-Encoding",
"gzip, deflate");
web_add_auto_header("Accept-Language",
"zh-cn");
web_add_auto_header("User-Agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 2.0.50727; .NET CLR 3.5.30428; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)");
//LoadRunder自动生成
web_reg_save_param("Siebel_Analytic_ViewState4",
"LB/IC=ViewState\" value=\"",
"RB/IC=\"",
"Ord=1",
"RelFrameId=1",
"Search=Body",
LAST);
lr_think_time(6);
web_submit_data("default.aspx_2",
"Action=http://localhost/CRMPerformanceTest/default.aspx",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost/CRMPerformanceTest/default.aspx",
"Snapshot=t39.inf",
"Mode=HTML",
ITEMDATA,
"Name=__EVENTTARGET", "Value=ddlParent", ENDITEM,
"Name=__EVENTARGUMENT", "Value=", ENDITEM,
"Name=__LASTFOCUS", "Value=", ENDITEM,
"Name=__VIEWSTATE", "Value={Siebel_Analytic_ViewState2}", ENDITEM,
"Name=ddlParent", "Value= -- Orbitel", ENDITEM,
"Name=txtParentDealerID", "Value=", ENDITEM,
"Name=txtDealerTypeID", "Value=", ENDITEM,
"Name=txtDealerName", "Value=", ENDITEM,
"Name=txtProvisionName", "Value=", ENDITEM,
"Name=txtDealerNameM", "Value=", ENDITEM,
"Name=txtProvisionNameM", "Value=", ENDITEM,
"Name=ddlParentT", "Value=ORBITEL", ENDITEM,
"Name=txtTarget", "Value=", ENDITEM,
"Name=txtDealerID", "Value=", ENDITEM,
LAST);
lr_start_transaction("add");
lr_think_time(7);
web_submit_data("default.aspx_3",
"Action=http://localhost/CRMPerformanceTest/default.aspx",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost/CRMPerformanceTest/default.aspx",
"Snapshot=t40.inf",
"Mode=HTML",
ITEMDATA,
"Name=__EVENTTARGET", "Value=", ENDITEM,
"Name=__EVENTARGUMENT", "Value=", ENDITEM,
"Name=__LASTFOCUS", "Value=", ENDITEM,
"Name=__VIEWSTATE", "Value={Siebel_Analytic_ViewState4}", ENDITEM,
"Name=ddlParent", "Value= -- Orbitel", ENDITEM,
"Name=txtParentDealerID", "Value=1000150086", ENDITEM,
"Name=txtDealerTypeID", "Value=3", ENDITEM,
"Name=txtDealerName", "Value=DealerName", ENDITEM,
"Name=txtProvisionName", "Value=ProvisionName", ENDITEM,
"Name=btnSave", "Value=Save", ENDITEM,
"Name=txtDealerNameM", "Value=", ENDITEM,
"Name=txtProvisionNameM", "Value=", ENDITEM,
"Name=ddlParentT", "Value=ORBITEL", ENDITEM,
"Name=txtTarget", "Value=", ENDITEM,
"Name=txtDealerID", "Value=", ENDITEM,
LAST);
lr_end_transaction("add", LR_AUTO);
//新增完成以后,DealerID 才会回传到页面上,现在才能保存DealerID,为修改提供依据
我写的保存
web_reg_save_param("CurrentDealerID",
"LB/IC=txtDealerID",
"RB/IC=txtDealerID",
"Ord=1",
"Search=Body",
"RelFrameId=1",
LAST);
lr_start_transaction("modify");
lr_think_time(20);
//自动生成的可以打印
lr_log_message("CurrentDealerID ID is : %s", lr_eval_string("{Siebel_Analytic_ViewState4}"));
//我写的打印不了
lr_log_message("CurrentDealerID ID is : %s", lr_eval_string("{CurrentDealerID}"));
lr_end_transaction("modify", LR_AUTO);
[ 本帖最后由 cexowyc 于 2009-9-30 10:22 编辑 ] web_reg_save_param 要放在查询的URL前面,不是后面 default.aspx_3 的Server Response中有
<td>
<input name="txtDealerID" type="text" value="1400000168" id="txtDealerID" />
</td>
就是这情况下,还是报
Warning: The string 'CurrentDealerID' with parameter delimiters is not a parameter 谢谢版主的回复,不过我的问题是
页面上有一个DealerID的Textbox,并且有新增和修改按钮
点新增按钮以后,系统会将新增的DealerID传回到页面,
点修改的时候,系统回根据Textbox的值,修改刚增加的Dealer
我的注册param是放在新增以后,就是在 Default.apsx_3后面,因为此时 txtDealerID 才有值
取得该值以后,再去修改,我的修改部分代码没有贴,因为太多了 :L chimera已经说的很清楚了
txtDealerID的值是Default.apsx_3这步操作server端返回的,所以,你把web_reg_save_param放在Default.apsx_3之前去获取该步操作server即将返回的txtDealerID的值
回复 8# 的帖子
受教,受教,问题解决 ,一直以为LR是拿到客户端以后再取,现在才知道,LR是介于客户端和服务器之间取值的,楼主与断寒 web_reg_save_param是注册函数吧在LR向服务器发这个请求函数之前就要进行注册了。
页:
[1]