From: Corey Watts Date: 2010-10-29T03:54:51+09:00 Subject: Re: mechanize - extract href Thanks! I eventually came up with something like this: website = page.search("//div[@class='listing_content']/ul[@class='features']/li[1]") # initializes the link variable with something link = "super" # The segment below grabs the URL of the listing's website, if it has one. Otherwise it # puts 'nil' into the link variable if website.inner_text() == "ยป Website" website.search("a").map do |l| link = l['href'] end else link = "nil" end -- Posted via http://www.ruby-forum.com/.