From: Andrea Dallera Date: 2010-09-13T06:02:19+09:00 Subject: Re: Mechanize file save on generated link Hi Dan, try with File.open('myfile', 'w+') do |file| file << agent.get_file(link['href']) end where agent is the mechanize agent you used to log in and get the link. -- Andrea Dallera http://github.com/bolthar/freightrain http://usingimho.wordpress.com Il 12/09/2010 22:53, Dan Mansfield ha scritto: > Hi there, > I'm working on a project to automate retrieval of content and the > download of a pdf bill from an ISPs website. I have 30 connections with > this ISP and each has its own username and password. So far I have been > able to get the content I need that is actually stored within the page. > > You have to login and go to a specific page to be able to click on the > link. > The link itself isn't the pdf as its generated on the fly: > source code of the link: > onclick="cmCreatePageElementTag('Download PDF', 'Member Centre');" > class="btn_Link">Download PDF > > I'm selecting it with: > link = invoice_page.links_with(:href => "/be-portal/downloadPdf") > > how can I click this link to download the pdf and store it to the > filesystem? > > btw, I only started with Ruby and Mechanize less than 24 hours ago. > TIA > Regards, > Dan