LR回放时报错No match found for the requested parameter

上一篇 / 下一篇  2017-06-12 15:45:22

LR回放时报错

No match found for the requested parameter "Session". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size


报这个错说明没关联到值,没关联到只有2种可能:要么左右边界错误,要么关联函数位置放错。

脚本如下:

[html] view plain copy
  1. Action()  
  2. {  
  3.   
  4.     web_url("WebTours",   
  5.         "URL=http://localhost:1080/WebTours/",   
  6.         "Resource=0",   
  7.         "RecContentType=text/html",   
  8.         "Referer=",   
  9.         "Snapshot=t15.inf",   
  10.         "Mode=HTML",   
  11.         EXTRARES,   
  12.         "Url=http://act.cmcmcdn.com/upload/201507/8afc2fe48db9060fe1bdda2089e1d950.png", ENDITEM,   
  13.         "Url=http://act.cmcmcdn.com/upload/201507/3b491068507d8f85ea7b35d756da7215.png", ENDITEM,   
  14.         LAST);  
  15.   
  16.     lr_think_time(12);  
  17.   
  18.     web_reg_save_param("Session",  
  19.         "LB=name=userSession value=",  
  20.         "RB=>",  
  21.         LAST);  
  22.   
  23.     web_submit_data("login.pl_2",   
  24.         "Action=http://localhost:1080/WebTours/login.pl",   
  25.         "Method=POST",   
  26.         "RecContentType=text/html",   
  27.         "Referer=http://localhost:1080/WebTours/nav.pl?in=home",   
  28.         "Snapshot=t17.inf",   
  29.         "Mode=HTML",   
  30.         ITEMDATA,   
  31.         "Name=userSession", "Value={Session}", ENDITEM,   
  32.         "Name=username", "Value=jojo", ENDITEM,   
  33.         "Name=password", "Value=bean", ENDITEM,   
  34.         "Name=JSFormSubmit", "Value=on", ENDITEM,   
  35.         "Name=login.x", "Value=42", ENDITEM,   
  36.         "Name=login.y", "Value=8", ENDITEM,   
  37.         LAST);  
  38.   
  39.     web_image("SignOff Button",   
  40.         "Alt=SignOff Button",   
  41.         "Snapshot=t18.inf",   
  42.         LAST);  
  43.   
  44.     return 0;  
  45. }  

解决方案:

我的脚本中,把关联函数放在了web_submit_data的前面,但是web_submit_data函数是需要使用Session了,所以肯定要在web_submit_data函数之前关联到Session,所以在web_submit_data前面的请求找,看哪个请求的response(响应)中有session的值,有就把关联函数放那个请求前面。找了之后发现web_url("WebTours", 这个请求的response里面有session的值,并且就是web_submit_data函数中所用的session值,所以应该将关联函数放web_url("WebTours",请求之前。

修改后代码如下:

[html] view plain copy
  1. Action()  
  2. {  
  3.     web_reg_save_param("Session",  
  4.         "LB=name=userSession value=",  
  5.         "RB=>",  
  6.         LAST);  
  7.   
  8.     web_url("WebTours",   
  9.         "URL=http://localhost:1080/WebTours/",   
  10.         "Resource=0",   
  11.         "RecContentType=text/html",   
  12.         "Referer=",   
  13.         "Snapshot=t15.inf",   
  14.         "Mode=HTML",   
  15.         EXTRARES,   
  16.         "Url=http://act.cmcmcdn.com/upload/201507/8afc2fe48db9060fe1bdda2089e1d950.png", ENDITEM,   
  17.         "Url=http://act.cmcmcdn.com/upload/201507/3b491068507d8f85ea7b35d756da7215.png", ENDITEM,   
  18.         LAST);  
  19.   
  20.     lr_think_time(12);    
  21.   
  22.     web_submit_data("login.pl_2",   
  23.         "Action=http://localhost:1080/WebTours/login.pl",   
  24.         "Method=POST",   
  25.         "RecContentType=text/html",   
  26.         "Referer=http://localhost:1080/WebTours/nav.pl?in=home",   
  27.         "Snapshot=t17.inf",   
  28.         "Mode=HTML",   
  29.         ITEMDATA,   
  30.         "Name=userSession", "Value={Session}", ENDITEM,   
  31.         "Name=username", "Value=jojo", ENDITEM,   
  32.         "Name=password", "Value=bean", ENDITEM,   
  33.         "Name=JSFormSubmit", "Value=on", ENDITEM,   
  34.         "Name=login.x", "Value=42

TAG: requested

 

评分:0

我来说两句

Open Toolbar