# Do the basic watir initialization, then you should be able to get
away with something like this.

links = browser.links.to_a
links.select! {|link| link.href =~ /yp.kd.com/} # Omit all links to
different domains

puts "Writing #{links.length} links to links.txt"

# Write each link to the file
File.open( 'links.txt', 'w' ) do |file|
  links.each do |link|
    file.puts "#{link.text}; #{link.href.gsub(/^http:\/\//, "")}"
  end
end

-- 
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]

Reply via email to