[Webtest] Need help on clicking dynamic link

Paul King webtest@lists.canoo.com
Wed, 19 Apr 2006 18:52:27 +1000


Maybe something like:

   <invoke.../>
   <retry maxcount="999">
      <clickLink label="Next"/>
      <verifyXPath xpath="count(//a[text()='Next'])" text="0"/>
   </retry>

I presumed you have links with the label 'Next'.
You would need to change that to match your html.
You might need a <sleep> inside the <retry> loop, say 1 sec.
You might also need an <ifStep> around the <retry>
for cases where there is only one page.

Cheers, Paul.

Alvin Lo wrote:
> hi,
>  The website that i am testing have a table, and links(more/fewer) to 
> control how many rows to display.  (we have a href for more and href for 
> fewer).  Before i run any webtest, I need to get the webpage to a 
> predictable state, that is to expand the table to display max rows.  To 
> do this, I will need to keep clicking on the more-link.
>  This is what i want to do
> 
>  while (if-more-href-exist)
>  {
>    click on the link
>    get the latest page
>  }
> 
>  Can anyone let me how to do this?
>  I did consider to use groovy step, but how do u do that? how to check 
> the existing of a link in goovy and how to click a link inside goovy.  
> Is there any better to do this?
> 
> Thanks