I don't have html for your site, but if there is some predictable container
such as a div with an id like 'results' then you could do something like
this (also presumes the only links inside the results are to actual
results, and not things like upvotes etc.. in that case you may need to be
more stringent in identifying the link to be clicked, for guidence there we
would HAVE to see sampleHTML. )
do your search
10.times do |i|
browser.div(:id => 'results).link(:index => i).click
(whatever you need to do with the resulting page if anything)
browser.back
end
If you need to do more than the first page of results, then wrap that loop
in something that clicks the 'next page' link as many times as you need to.
Note: unless you work for the company that makes the site, please be sure
to check their terms of service, many of them forbid automated access,
especially link scraping etc) without prior written permission, or restrict
such access to authorized users of their API and demand it be done via the
api.
On Monday, April 23, 2012 6:51:57 AM UTC-7, Željko Filipin wrote:
>
> On Sat, Apr 21, 2012 at 10:42 PM, Raghu k <[email protected]> wrote:
> > Something like ths would help .. Please help me with a quick code...
>
> Is there a problem with the code you have posted?
>
> Željko
> --
> watir.com/book - author
>
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]