Ooops. Sorry, gave you defective code on that example (note to self: test
the code you give to a total stranger)

all_links_href = Array.new
$ie.links.each {|link| all_links_href << link.href}

however Watir doesn't discriminate what kind of a href it is so you will end
up with all javascript type links
You will need to furhter extract that array based on your needs.
But definitely try hpricot
marekj


On 6/27/07, marekj <[EMAIL PROTECTED]> wrote:

You can harvest all the links href and stuff them in array:
all_links_href = $ie.links.each { |link| link.href}
Clicking could be a problem because after you click the first one you are
no longer on the page.
all_links_href.each { |href| $ie.link(:href, href).click}
Does anybody know how to click a link and force it to open in a new
window?

Also if you don't really care about outgoing links and just need links
harvesting you can use hpricot gem.
http://code.whytheluckystiff.net/hpricot/wiki/HpricotBasics


On 6/27/07, Ruben <[EMAIL PROTECTED] > wrote:
>
> Is it possible to make watir click on every link on the page and tell me
> if the click was successfull (as in not 404 error). Also is it possible to
> make it click on only the links with a certain extention?
>
> thanks.
> _______________________________________________
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>


_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to