LoadRunner Support Forum
Showing results for 
Search instead for 
Do you mean 

How to submit a form that item value contains new line or space?

Visitor

How to submit a form that item value contains new line or space?

[ Edited ]

Here is the flow,

I request a URL, get a JSON return,  "requestId":"abc\\nabc"

Then I use this to catch it.

web_reg_save_param_regexp(
"ParamName=requestId",
"RegExp=\"requestId\":\"(.*?)\"",
SEARCH_FILTERS,
"Scope=Body",
LAST);

 In replay log, Notify: Saving Parameter "requestId = abc\nabc"

 

finally, submit the form

web_submit_data("statusPoll", 
	"Action=http://someurl/pages/statusPoll", 
	"Method=POST", 
	"RecContentType=application/json", 
        "Referer=http://someurl/pages/vehicle_status.jsp", 
	"Snapshot=t24.inf", 
	"Mode=HTML",
    "EncType=",
	ITEMDATA, 
	"Name=requestId", "Value={requestId}", ENDITEM, 
	LAST);

 In the detail log:

tor.c(93): t=132597ms: 168-byte request body for "http://someurl/pages/statusPoll" (RelFrameId=1, Internal ID=97)
tor.c(93): requestId=abc%5Cnabc

 

-------------------------- issue ------------------------

 

loadrunner did not url encode the \n newline to %0A as expected, actually loadrunner url encode \ to %5C ; n to n.

 

So, how can I got %0a in POST form?

 

and I try to use web_convert_param("requestId", "SourceEncoding=PLAIN", "TargetEncoding=URL", LAST ); It turned out some story.

 

Thank you!

 

 

1 REPLIES
Visitor

Re: How to submit a form that item value contains new line or space?

After some google, Maby I can use custom replace string function and web_custom_request to resove this issue.