Hello.
I''m still working on learning Mechanize.
I''ve got a standard form that returns multiple pages of results. What
I
need to do is follow the links to the next pages until I''ve reached the
end.
I have the code that brings back the results from the first page and I can
then see the link with the inner_html value of "Next".
How can I continue to move through the rest of the results set?
I have this
a = WWW::Mechanize.new { |agent|
agent.user_agent_alias = ''Mac Safari''
agent.set_proxy(''proxy'', ''80'',
''user'', ''pwd'')
}
a.get(''http://www.website.com) do |page|
page = page.form_with(:name => ''search1'') do
|search|
search.checkboxes.name(''feature'').check
end.submit
next_links = page.at("a[text()*=''Next'']")
puts "next links: #{next_links}"
a.click page.at("a[text()*=''Next'']") do |n|
inside = n.at("a[text()*=''Next'']")
puts "inside #{inside}"
end
The next_links will give me the link to the next page so I know that the
initial search will give me the result that I need. So how can I translate
that next_link into something that I can use to transverse through the rest
of the pages?
I tried to follow the "Finding Links" section in Guide.txt and the
transact
method in Examples.txt, but I couldn''t put these 2 together to make it
work
correctly. I''m sure that I''m mixing it all together and
making a mess.
Thanks so much for the great help!!!
Cindy
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/mechanize-users/attachments/20081112/114599b8/attachment.html>