请各位斑竹,高手帮忙解决下,LR脚本关联问题
本帖最后由 gao9960 于 2012-2-10 14:26 编辑求高手解救啊
给下面这段脚本做关联
web_submit_data("examAction!getExamlist",
"Action=http://10.71.0.175:7070/tiandun/web/jsp/personal/web/jsp/personal/examAction!getExamlist",
"Method=POST",
"EncType=multipart/form-data",
"RecContentType=text/html",
"Referer=http://10.71.0.175:7070/tiandun/web/jsp/personal/examAction!examLogin",
"Snapshot=t14.inf",
"Mode=HTML",
ITEMDATA,
"Name=exam.SCREEN_ID", "Value={screen_id}", ENDITEM,
"Name=exam.FILE_NUMBER", "Value={file_number}", ENDITEM,
"Name=exam.SUBJECT_ID", "Value={subject_id}", ENDITEM,
"Name=exam.PERSON_ID", "Value={person_id}", ENDITEM,
"Name=exam.BATCH_NUMBER", "Value={batch_number}", ENDITEM,
"Name=exam.REAL_EXAM_ID", "Value={real_exam_id}", ENDITEM,
"Name=exam.EXAM_ID", "Value={exam_id}", ENDITEM,
EXTRARES,
"Url=/tiandun/web/images/exam/exam-title-repeatx.jpg", "Referer=http://10.71.0.175:7070/tiandun/web/exams/examTitle.jsp", ENDITEM,
"Url=/tiandun/web/images/exam/exam-lable.jpg", "Referer=http://10.71.0.175:7070/tiandun/web/exams/examContent.jsp", ENDITEM,
"Url=/tiandun/web/images/exam/exam-help.jpg", "Referer=http://10.71.0.175:7070/tiandun/web/exams/examInfo-bottom.jsp", ENDITEM,
"Url=/tiandun/web/images/exam/exam-list.jpg", "Referer=http://10.71.0.175:7070/tiandun/web/exams/examInfo-middle.jsp", ENDITEM,
"Url=/tiandun/web/css/PIE.htc", "Referer=", ENDITEM,
LAST);
下面是我写的关联脚本
web_reg_save_param("screen_id",
"LB=\t\t\t\t\t\t<input type=\"hidden\" name=\"exam.SCREEN_ID\" value=\"",
"RB=\" />\r\n",
"Notfound=warning",
LAST);
lr_log_message("screen_id=%s",lr_eval_string("{screen_id}"));
web_reg_save_param("file_number",
"LB=\t\t\t\t\t\t<input type=\"hidden\" name=\"exam.FILE_NUMBER\" value=\"",
"RB=\" />\r\n",
"Notfound=warning",
LAST);
web_reg_save_param("subject_id",
"LB=\t\t\t\t\t\t<input type=\"hidden\" name=\"exam.SUBJECT_ID\" value=\"",
"RB=\" />\r\n",
"Notfound=warning",
LAST);
web_reg_save_param("person_id",
"LB=\t\t\t\t\t\t<input type=\"hidden\" name=\"exam.PERSON_ID\" value=\"",
"RB=\" />\r\n",
"Notfound=warning",
LAST);
web_reg_save_param("batch_number",
"LB=\t\t\t\t\t\t<input type=\"hidden\" name=\"exam.BATCH_NUMBER\" value=\"",
"RB=\" />\r\n",
"Notfound=warning",
LAST);
web_reg_save_param("real_exam_id",
"LB=\t\t\t\t\t\t<input type=\"hidden\" name=\"exam.REAL_EXAM_ID\" value=\"",
"RB=\" />\r\n",
"Notfound=warning",
LAST);
web_reg_save_param("exam_id",
"LB=\t\t\t\t\t\t<input type=\"hidden\" name=\"exam.EXAM_ID\" value=\"",
"RB=\" />\r\n",
"Notfound=warning",
LAST);
但是回放都是警告:Warning: The string 'screen_id' with parameter delimiters is not a parameter.
这是log里的数据
Action.c(55): \t\t\t\t\t\t\r\n
Action.c(55): \t\t\t\t\t\t<p class="exam-subject">??????????</p>\r\n
Action.c(55): \t\t\t\t\t\t<p class="exam-name">????????2</p>\r\n
Action.c(55): \t\t\t\t\t\t<p class="exam-id">330314198811200022</p>\r\n
Action.c(55): \t\t\t\t\t\t<p class="exam-session">3325022012021003</p>\r\n
Action.c(55): \t\t\t\t\t\t<p class="exam-seat">3325012012020021</p>\r\n
Action.c(55): \t\t\t\t\t\t<p class="exam-date">2012-02-10</p>\r\n
Action.c(55): \t\t\t\t\t\t<input type="hidden" name="exam.SCREEN_ID" value="3325022012021003" />\r\n
Action.c(55): \t\t\t\t\t\t<input type="hidden" name="exam.FILE_NUMBER" value="3325012012000021" />\r\n
Action.c(55): \t\t\t\t\t\t<input type="hidden" name="exam.SUBJECT_ID" value="1601" />\r\n
Action.c(55): \t\t\t\t\t\t<input type="hidden" name="exam.PERSON_ID" value="330314198811200022" />\r\n
Action.c(55): \t\t\t\t\t\t<input type="hidden" name="exam.BATCH_NUMBER" value="1" />\r\n
Action.c(55): \t\t\t\t\t\t<input type="hidden" name="exam.REAL_EXAM_ID" value="58" />\r\n
Action.c(55): \t\t\t\t\t\t<input type="hidden" name="exam.EXAM_ID" value="73" />\r\n
Action.c(55): \t\t\t\t\t\t\r\n 你关联的概念完全是错误的,你希望发送动态内容,那么你提交中的参数应该是通过关联获得的,那么关联函数肯定是在你现在这个请求前面的请求返回的,你不能先用未定义的参数,然后在后面再写关联! 回复 2# 云层
我发现了,在那天下午自己处理了,现在有个问题我不知道怎么处理:
Action.c(130): t=9865ms: 1-byte chunked response body for "http://10.71.0.175:7070/tiandun/web/jsp/personal/web/jsp/personal/examAction!examRead" (RelFrameId=1, Internal ID=19)
Action.c(130): 1
Action.c(130): t=9870ms: Request done "http://10.71.0.175:7070/tiandun/web/jsp/personal/web/jsp/personal/examAction!examRead"
这段日志,我希望把那个1关联,这个应该怎么写,我是这么写的,但是取不到,帮忙看下,刚刚开始学loadrunner
web_reg_save_param("exam_login_flig",
"LB=byte chunked response body for \"http://10.71.0.175:7070/tiandun/web/jsp/personal/web/jsp/personal/examAction!examRead\" (RelFrameId=1, Internal ID=",
"RB=t=",
"SaveOffset=7",
"NotFound=warning",
LAST); 看代码给我的感觉你是返回了1啊,关联没啥错把,你现在写的关联是彻底错的! 回复 4# 云层
应该怎么写啊? 回复 4# 云层
Action.c(130): t=9865ms: 1-byte chunked response body for "http://10.71.0.175:7070/tiandun/web/jsp/personal/web/jsp/personal/examAction!examRead" (RelFrameId=1, Internal ID=19)
Action.c(130): 1
Action.c(130): t=9870ms: Request done "http://10.71.0.175:7070/tiandun/web/jsp/personal/web/jsp/personal/examAction!examRead"
云大大能告诉我怎么把这个1给取出来做关联吗??谢谢 你在Action.c(130): 1不是已经得到1了么
启动日志看一下参数值对不对就行了啊 本帖最后由 gao9960 于 2012-2-20 09:57 编辑
回复 7# 云层
这个以是这段代码获取的
web_custom_request("examAction!examRead",
"URL=http://10.71.0.175:7070/tiandun/web/jsp/personal/web/jsp/personal/examAction!examRead",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://10.71.0.175:7070/tiandun/web/jsp/personal/examAction!examLogin",
"Snapshot=t15.inf",
"Mode=HTML",
"EncType=",
LAST);
我现在是想把它获得的1取出来当做一个判断的条件,但是1的前后什么都没有,用web_reg_save_param这个函数我不会取啊
这是这段代码的图
这图是这段代码获取到0的时候,日志是这样的
Action.c(130): t=9865ms: 1-byte chunked response body for "http://10.71.0.175:7070/tiandun/web/jsp/personal/web/jsp/personal/examAction!examRead" (RelFrameId=1, Internal ID=19)
Action.c(130): 0
Action.c(130): t=9870ms: Request done "http://10.71.0.175:7070/tiandun/web/jsp/personal/web/jsp/personal/examAction!examRead"
我怎么把这个独立一行的0取出来。
页:
[1]