I need to get the href value of links on a page that match a regex.

So, I run this code:

product_links = browser.links.find_all { | link | link.class_name =~ 
/(Product|Detail)/i }

I get back an array of matching links. This is great.

However, the contents of the array include more than just the href of the 
links.

When I look at the contents of the first element of the array, using...

puts products_links[0]

...the output looks like this:

name:         
type:         
id:           
value:        
disabled:     
href:         /Cold-Water-Lobster-Tails.3.htm
inner text:   Cold Water Lobster Tails

If I use...

p products_links[0]

...the output looks like this:

#<FireWatir::Link:0x2c87d00 located=true how=:jssh_name 
what="arr_coll_A_0[135]">

I just want the href.

How do I extract just the href string from the product_links array?

Or, is there a better way to get all the href values of the links that match 
my regex?

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to