How can we search for a particular string in response body and save it in a text file in LoadRunner

  • Questions
  • How can we search for a particular string in response body and save it in a text file in LoadRunner
Question ID: 104401
3
0

Hey all, How can we search for a particular string in response body and save it in a text file in LoadRunner?

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on October 21, 2011 8:04 am
111 views
Answers (1)
0
Private answer

Here is some rough code that will accomplish this. You'll need to tweak the LB and RB in your code. This will produce a text file in the scripts subdirectory with a list of the URLs on the page.

Action()
{
int i;
int number;
long file;
char URL[300];
char filename[20];
char namestr[20];

web_reg_save_param(''URL'',''LB=href='''',''RB='''',''ORD=All'',LAST);

web_url(''dogpile.com'',
''URL=http://dogpile.com/'',
''Resource=0'',
''RecContentType=text/html'',
''Referer='',
''Snapshot=t1.inf'',
''Mode=HTML'',
EXTRARES,
LAST);

sprintf(filename,''%s'',''URL.txt'');
number=atoi(lr_eval_string(''{URL_count}''));
lr_output_message(''There are %d URL's captured'',number);

if ((file = fopen(filename, ''wb+'' )) == NULL)
{
lr_output_message(''Unable to create %s'', filename);
return -1;
}

for(i=1;i

Marked as spam
Posted by (Questions: 6, Answers: 167)
Answered on October 24, 2011 6:07 pm
It works. Thank you. :)
( at October 25, 2011 6:29 am)
Great, glad to hear it. Please vote my answer up and mark this as an accepted answer by clicking on the check and the thumbs up, Thanks.
( at October 25, 2011 9:31 am)
EyeOnTesting