From: Peter Szinek Date: 2008-10-16T02:43:58+09:00 Subject: Re: Mechanize and XPath --Apple-Mail-3-972318490 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On 2008.10.15., at 19:08, Ruby Newbie wrote: > > Is there a way to select links in a scraped mechanize page using XPath > selectors ? > > For example...all links on the second TABLE on the page. > > > I know it is possible with hpricot but i need the links to be used by > mechanize. From the Mechanize guide (http://mechanize.rubyforge.org/mechanize/files/GUIDE_txt.html ): Mechanize uses hpricot to parse html. What does this mean for you? You can treat a mechanize page like an hpricot object. After you have used Mechanize to navigate to the page that you need to scrape, then scrape it using hpricot methods: agent.get('http://someurl.com/').search("//p[@class='posted']") HTH, Peter --Apple-Mail-3-972318490--