Another thought is that the word 'next' could be hidden in the html,
although I'm not sure if Watir searches for hidden text.

On Aug 21, 10:12 am, Chuck van der Linden <[email protected]> wrote:
> Seems to me that the letters 'next'  might be rather common to find on
> a lot of pages, and are you SURE it's not there even if perhaps part
> of another word?
>
> If the 'next' is a clickable link or button , then perhaps you'd be
> better off to look to see if the link exists?
>
> while browser.link(:text, 'Next').exists?
>   or
> while browser.button(:text, 'Next').exists?
>
> That's a lot less likely to give you a false hit on some other aspect
> of the page contents
>
> On Aug 20, 1:38 pm, curious <[email protected]> wrote:
>
>
>
> > I have below WATIR code, which will download series of web pages by
> > navigating thru page number.  Each search will present series of
> > pages, and the last page in the series does not contain the text
> > 'Next'.
>
> > However, below code keeps running and goes on presenting the last page
> > that does not contain the text "Next".  It seems to me that the while
> > condition is true to the page right before the last page, and this
> > page right before the last page contains the text, "Next", and it
> > never goes out of the loop, [ ... while ie.contains_text
> > ("Next")......].
>
> > Is there anyway to make it get out of the loop?  The last page surely
> > does not contain the text, "Next", but it seems to me that below code
> > does not detect it.
>
> > Any help / suggestion will be deeply appreciated.
>
> > Thank you.
>
> > --------------------------------------------------------------------------- 
> > ­-------------------------------------------------------------
>
> > while ie.contains_text("Next")
>
> >   File.open("#{PageNo}.html", "wb") { |f|
>
> >   f << '<html>'
> >   f << ie.html
> >   f << '</html>'
>
> >   PageNo = PageNo + 1
>
> >   ie.goto("http://www.test.com/#{PageNo}";
>
> > end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to