Hi,

I have used the below code, to check a particular field in a cell for all
rows of a table displaying on the HTML page:-

<repeat startCount="3" count="20" countername="row">
<ifStep>
    <condition>
        <storeXPath
xpath="/html/body/form/table/tbody/tr[2]/td[3]/table/tbody/tr[2]/td/div/table/tbody/tr[#{row...@style='font-weight:bold;']/td[5]"
property="chk" />
    </condition>
<then>
    <clickLink
xpath="/html/body/form/table/tbody/tr[2]/td[3]/table/tbody/tr[2]/td/div/table/tbody/tr[#{row}]/td[6]/h1/a"/>
    <ifStep>
        <condition>
            <verifyXPath
xpath="/html/body/form/table/tbody/tr[2]/td[3]/table/tbody/tr[2]/td/table/tbody/tr/td/table/tbody/tr/td"/>
        </condition>
    <then>
        <storeXPath
xpath="/html/body/form/table/tbody/tr[2]/td[3]/table/tbody/tr[2]/td/table/tbody/tr/td/table/tbody/tr/td"
property="subject" />
    </then>
    <else>
        <clickLink label="Inbox"/>
        <storeXPath
xpath="/html/body/form/table/tbody/tr[2]/td[3]/table/tbody/tr[3]/td/div/table/tbody/tr[#{row}]/td[6]/h1/a"
    property="subject" />
    </else>
    </ifStep>
</then>
</ifStep>
</repeat>

I just iterated the loop for 20 times for the page and this works fine for
my web page.

Hope this helps..

Hitesh




On Fri, Sep 17, 2010 at 5:09 PM, Thomas Klein <[email protected]> wrote:

> Perhaps this...
> http://www.javakb.com/Uwe/Forum.aspx/java-programmer/36251/Loop-in-Ant
> ...helps?
>
> Cheers,
>
> Thomas Klein
> Senior Associate QA | SapientNitro
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of mascis
> Sent: Friday, September 17, 2010 12:31 PM
> To: [email protected]
> Subject: Re: [Webtest] While -step in Webtest
>
>
> Hi,
>
> I tried those suggestions but they didn't help. I tried similar solutions
> in
> the first place also but I didn't post them here since they didn't work.
>
> -Juho
>
>
> Guillaume Richard wrote:
> >
> > Hi, quickly passing here...
> > If you're trying to make a non-ending loop, your code can't work :
> >
> > Webtest repeat webpage reference :
> >
> > "
> > counterNameRequired? no, default is countThe name that shall be used to
> > reference the current repetition counter."
> > As I see your repeat step config :
> > <repeat endCount="#{end}">
> >
> > you've specified your loop to stop after 2 (#{end}=2) iterations, but
> what
> > you are modifying :
> > <storeProperty name="end" value="1" />
> > is not the iterative counter, since the iterative counter should be named
> > 'count' (previous webtest website reference)... ?
> >
> > Maybe I'm wrong, but you'd rather try :
> > <storeProperty name="count" value="1" />
> >
> > or
> > <repeat endCount="2" counterName="end">
> > <storeProperty name="end" value="1" />
> > </repeat>
> >
> > Regards,
> >
> > Guillaume
> >
> > 2010/9/17 mascis <[email protected]>
> >
> >>
> >> Hi,
> >>
> >> Yes, this piece of code is supposed to make a never-ending loop but it
> >> does
> >> not and that's the problem. I have to make my loop works like a
> >> while-loop
> >> and I don't know how to make it work without manipulating endCount
> >> similar
> >> way I tried to manipulate it in the code I posted before. But because
> >> that
> >> code don't make a never-ending loop the while loop I need won't work
> >> either.
> >> I have to get this never-ending loop work or find a new way to make a
> >> while-loop.
> >>
> >> -Juho
> >>
> >>
> >> Thomas Klein-10 wrote:
> >> >
> >> > Hi,
> >> >
> >> > I haven't ever used/tried this, but I guess you should avoid to
> >> manipulate
> >> > the counter value within the loop... Your example below looks like a
> >> > never-ending loop to me. Sorry if I'm wrong though.
> >> >
> >> > What is is that you want to achieve (I mean: which steps are in the
> >> loop?)
> >> > Can you give a more detailed example?
> >> >
> >> > Regards,
> >> > Thomas
> >> >
> >> >
> >> > Thomas Klein
> >> > Senior Associate QA | SapientNitro
> >> > -----Original Message-----
> >> > From: [email protected] [mailto:
> >> [email protected]]
> >> > On Behalf Of mascis
> >> > Sent: Friday, September 17, 2010 10:26 AM
> >> > To: [email protected]
> >> > Subject: RE: [Webtest] While -step in Webtest
> >> >
> >> >
> >> > Mabye my programming skills are not good enough but I can't get this
> >> > working.
> >> > I don't know how make test to end after certain ifStep passes or even
> >> work
> >> > like a while-loop. I've tried to manipulate endCount and counterName
> >> but
> >> I
> >> > can't get them fixed inside the repeat-loop and I don't know any other
> >> way
> >> > to do this. This is what I tried:
> >> >
> >> > <storeProperty name="end" value="2" />
> >> > <repeat endCount="#{end}">
> >> >       <storeProperty name="end" value="1" />
> >> > </repeat>
> >> >
> >> > I tried to manipulate counterName also but it did not work either.
> >> >
> >> > -Juho
> >> >
> >> >
> >> > Jonathan Rosenberg-2 wrote:
> >> >>
> >> >> This is just what you need:
> >> >>
> >> >>      http://webtest.canoo.com/webtest/manual/repeat.html
> >> >>
> >> >> --
> >> >> Jonathan Rosenberg
> >> >> Founder & Executive Director
> >> >> Tabby's Place
> >> >> http://www.tabbysplace.org
> >> >>
> >> >>
> >> >> --
> >> >> Jonathan Rosenberg
> >> >> Founder & Executive Director
> >> >> Tabby's Place
> >> >> http://www.tabbysplace.org
> >> >>
> >> >>
> >> >> -----Original Message-----
> >> >> From: [email protected]
> >> >> [mailto:[email protected]]
> >> >> On Behalf Of mascis
> >> >> Sent: Friday, August 20, 2010 6:06 AM
> >> >> To: [email protected]
> >> >> Subject: [Webtest] While -step in Webtest
> >> >>
> >> >>
> >> >>
> >> >> I need to make a test that generates a (partly) random address and
> >> verify
> >> >> if
> >> >> it's existing or not. If it's not test should generate a new address
> >> and
> >> >> go
> >> >> there until the generated page exists.
> >> >> This could easily be done with a simple while-loop but as far as I
> >> know
> >> >> Webtest does not have one. I'm not sure if this could somehow be made
> >> >> with
> >> >> just if-step (I guess if-step should be able to refer to itself
> >> somehow).
> >> >> While-loop could be made by groovy-step but I don't know how to put
> >> >> verify
> >> >> text etc. steps inside the groovy code.
> >> >>
> >> >> Can someone help me?
> >> >> --
> >> >> View this message in context:
> >> >>
> http://old.nabble.com/While--step-in-Webtest-tp29490451p29490451.html
> >> >> Sent from the WebTest mailing list archive at Nabble.com.
> >> >>
> >> >> _______________________________________________
> >> >> WebTest mailing list
> >> >> [email protected]
> >> >> http://lists.canoo.com/mailman/listinfo/webtest
> >> >>
> >> >> _______________________________________________
> >> >> WebTest mailing list
> >> >> [email protected]
> >> >> http://lists.canoo.com/mailman/listinfo/webtest
> >> >>
> >> >>
> >> >
> >> > --
> >> > View this message in context:
> >> > http://old.nabble.com/While--step-in-Webtest-tp29490451p29736179.html
> >> > Sent from the WebTest mailing list archive at Nabble.com.
> >> >
> >> > _______________________________________________
> >> > WebTest mailing list
> >> > [email protected]
> >> > http://lists.canoo.com/mailman/listinfo/webtest
> >> > _______________________________________________
> >> > WebTest mailing list
> >> > [email protected]
> >> > http://lists.canoo.com/mailman/listinfo/webtest
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://old.nabble.com/While--step-in-Webtest-tp29490451p29736833.html
> >> Sent from the WebTest mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> WebTest mailing list
> >> [email protected]
> >> http://lists.canoo.com/mailman/listinfo/webtest
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/While--step-in-Webtest-tp29490451p29737043.html
> Sent from the WebTest mailing list archive at Nabble.com.
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>

Reply via email to