I
have a value which dynamic for each iteration. I have captured that value
using web_reg_save_param(correlation) function. Please any enahncement in the
script is most welcome….
Action_Main_URL()
{
char
MainID;
int
i;
char
Length[100];
long
file;
char
* filename = “c:\\Session.txt”;
if
((file = fopen(filename, “a+” )) == NULL)
{
lr_output_message(“Unable
to create %s”, filename);
return
-1;
}
web_reg_save_param(
“Cor_Session_Id”, “LB= value=’”, “RB=’”, “Ord=6″, “IgnoreRedirections=Yes”,
“Search=Body”, “RelFrameId=1″, LAST );
web_url(“Workplace”,
”URL=http://server/Workplace”,
”Resource=0″,
”RecContentType=text/html”,
”Referer=”,
”Snapshot=t1.inf”,
”Mode=HTML”,
LAST);
lr_start_transaction(“TS_Main_URL_Login”);
web_reg_find(“Text=Record
Search and Check-In”, “SaveCount=Value_Count”,
LAST);
web_submit_data(“WcmSignIn.jsp”,
”Action=http://server/Workplace/WcmSignIn.jsp?eventTarget=signInModule&eventName=SignIn”,
”Method=POST”,
”RecContentType=text/html”,
”Referer=http://server/Workplace/WcmSignIn.jsp?targetUrl=WcmDefault.jsp&targetBase=http%3A%2F%2Fserver%2FWorkplace&sessionId={Cor_Session_Id}&originIp=10.x.x.x&originPort=”,
”Snapshot=t2.inf”,
”Mode=HTML”,
ITEMDATA,
”Name=targetBase”, “Value=http://server/Workplace”, ENDITEM,
”Name=originPort”, “Value=”, ENDITEM,
”Name=targetUrl”, “Value=Default.jsp”, ENDITEM,
”Name=encodedSessionId”, “Value=null”, ENDITEM,
”Name=originIp”, “Value=10.x.x.x”, ENDITEM,
”Name=sessionId”, “Value={Cor_Session_Id}”, ENDITEM,
”Name=browserTime1″, “Value=Sat Jan 1 05 EST 2011″, ENDITEM,
”Name=browserTime2″, “Value=Wed Jun 15 05 EDT 2011″, ENDITEM,
”Name=browserOffset1″, “Value=300″, ENDITEM,
”Name=browserOffset2″, “Value=240″, ENDITEM,
”Name=clientTimeZone”, “Value=”, ENDITEM,
”Name=appId”, “Value=Workplace”, ENDITEM,
”Name=userId”, “Value=userid”, ENDITEM,
”Name=password”, “Value=password”, ENDITEM,
EXTRARES,
”Url=images/web/common/Banner.jpg”,
“Referer=http://server/Workplace/HomePage.jsp?mode=reset”, ENDITEM,
LAST);
if
(atoi(lr_eval_string(“{Value_Count}”)) > 0)
{
lr_output_message(“Page found successfully.”);
}
else
{
lr_error_message(“Page is not found.”);
lr_exit( LR_EXIT_MAIN_ITERATION_AND_CONTINUE,LR_FAIL );
return(0);
}
lr_end_transaction(“TS_Main_URL_Login”,LR_AUTO);
sprintf(Length,”\n%s,”,lr_eval_string(“{Cor_Session_Id}”));
i
= fwrite(&Length,sizeof(Length), 1, file);
if
( i > 0)
lr_output_message(“Successfully
wrote %d record”, i );
fclose(file);
return
0;
}