Contact us

check for weblink exists or not

ey Mark & all,

Thanks for getting me this stuff resolved..Here is what I did now, to
get the correct behavior emulated as per my scenario -

int nextFoundFlag= 1;
int tunFoundFlag= 1;
while ( nextFoundFlag! =0 && tunFoundFlag! =0 ){
web_reg_find( "Text=Next 50 Records",
"SaveCount=NextCOUN T",
LAST);
web_reg_find( "Text=TUN" ,
"SaveCount=TUNCOUNT ",
LAST);

if (strcmp(lr_eval_ string("{ NextCOUNT} "), "0") == 0) {
lr_message( "Next Not found");
nextFoundFlag= 0;
break;
}

if (strcmp(lr_eval_ string("{ TUNCOUNT} "), "0") == 0) {
lr_message( "TUN Not Found");
tunFoundFlag= 0;
break;

}


lr_start_transactio n("List address");

web_link("Next 50 Records",
"Text=Next 50 Records",
"Snapshot=t7. inf",
LAST);

lr_end_transaction( "List address", LR_AUTO);
}

Regards
Samir

--- In LoadRunner@yahoogro ups.com, "mark.sproson"
wrote:
>
> Hmmm, you're all being very encouraging but sometimes you have to
be
> cruel to be kind...!
>
> Two basic problems I can see here, Sameer. One is in your logic,
the
> other is in your understanding of how LoadRunner actually works.
>
> Firstly, look at the values rc1 and rc2. You set them to the result
> of a web_reg_find( ) then you loop until either of the values are
not
> equal to zero. The trouble is, once you're in the loop, the values
> will never change - so you either get the loop running for ever(or
> until you get some other error) or not at all. Nothing inside your
> loop can change the values of rc1 or rc2.
>
> Which leads me on to your second problem. I can see what you hope
> will happen - depending on whether the link text is found, the
> result code will get set in retrospect - so the result-code is
a "did
> we find it?" flag. Sorry, it doesn't work that way. web_reg_find( )
is
> a function to set up a search in the "future". The return code is a
> way of checking "did we set it up correctly"? It can never tell you
> anything about the search result, because the search hasn't
happened
> yet.
>
> So, you need to do two things. Firstly, move the web_reg_find( )
calls
> inside your loop, because you need to register a new find every
time
> you do the web_link() call. Secondly, you need to find the correct
> way of checking whether you found anything or not. There is an
option
> for this, and it's discussed in the documentation. Hint: another
way
> of saying "did we find it?" is "did we find more than zero
> occurences?"
>
> Keep trying!
>
> Mark
>
>
>
>
> --- In LoadRunner@yahoogro ups.com, Anand Kumar Pudota
> wrote:
> >
> > Good suggestion Michael,
> >
> > He is near to his solution. But needs toi understand all
options
> in web_reg_find statement.
> >
> > Sameer,
> >
> > Just use programatic knowledge and concept. Just think of "what
> if the text doesn't returned by server when there are no records(
As
> the link also will not be there)?"
> >
> > Hope you catch it...:)
> >
> >
> >
> >
> >
> >
> > Michael Foley wrote:
> > you are getting closer. now what do you need to do to
keep
> a failed web_reg_find from ending the script?
> >
> > hint - read the help
> >
> > -m
> >
> > ----- Original Message ----
> > From: samir_aecian1
> > To: LoadRunner@yahoogro ups.com
> > Sent: Sunday, December 2, 2007 12:04:50 AM
> > Subject: [LoadRunner] Re: Web HTTP VUgen function to check if a
web
> link exists
> >
> > This is what I did, but still fails at the last page as it is
> trying
> > to click on 'Next 5000 records' link though its not there-
> >
> > /*find text from 'Next 500 Records' link*/
> > rc1=web_reg_ find("Text= Next 500 Records",
> > LAST);
> > /*find anohter text from page which displays the static TEXT'TUN'
> > always*/
> > rc2 = web_reg_find( "Text=TUN" ,
> > LAST);
> > while (rc1==0 && rc2==0){
> > lr_start_transactio n("List address");
> > web_link("Next 500 Records",
> > "Text=Next 500 Records",
> > "Snapshot=t7. inf",
> > LAST);
> > lr_end_transaction( "List address", LR_AUTO);
> > }
> > exit( 0 );
> >
> > This is error from LR o/p-
> > (91): Error -27995: Requested link ("Text=Next 500 Records") not
> > found [MsgId: MERR-27995]
> > Action.c(91) : web_link("Next 500 Records") highest severity
level
> > was "ERROR", 0 body bytes, 0 header bytes [MsgId: MMSG-26388]
> >
> > Please check if my logic is correct?how can I get rid of this
error?
> >
> > Regards
> > Samir
> >
> > --- In LoadRunner@yahoogro ups.com, Michael Foley
>
> > wrote:
> > >
> > > you are on the right track.
> > >
> > > you just need to write your own loop
> > >
> > > -m
> > >
> > >
> > > ----- Original Message ----
> > > From: samir_aecian1
> > > To: LoadRunner@yahoogro ups.com
> > > Sent: Friday, November 30, 2007 2:29:33 AM
> > > Subject: [LoadRunner] Web HTTP VUgen function to check if a web
> > link exists
> > >
> > > hey,
> > >
> > > We have one web application where I need to query records for a
> > user
> > > page wise.When I submit the data(Client ID) initially to the
Web
> > > application, then it displays 1st 500 records belonging to the
> > > client.Now the client has 30,000 records and it may vary
> also..And
> > I
> > > need to check the how much time each 500 records display is
> taking.
> > >
> > > 1st time when I give submit user ID record,it displays 500
> > records.To
> > > view next 500 records,I have a web link 'Next 500 records' to
> click
> > > on.Till the last page is reached I have to keep clicking on
this
> > > link.But, I dont want to include so many web clicks in my
script
> > and
> > > this web clicks always will vary depending upon no. of records
a
> > > client can have.
> > > So, I want to know, if we have any functions available or any
> other
> > > way that I can put this 'Next 500 records' into a variable and
> then
> > > put it in while loop like 'while('Next 500 records' link==0)
then
> > kee
> > > on clicking on 'Next 500 records' web link.As long as the 'Next
> 500
> > > records' link exists the script should continue executing and
> then
> > > exit if not found.
> > >
> > > Your help is very much appreciated. ..let me know
> > >
> > > Regards

No comments: