When I click a link to download a file, a pop up window comes up to save the file. Is there a way to enter a file name and click the submit button with mechanize? Thanks, Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mechanize-users/attachments/20070712/558f7018/attachment.html
On 7/12/07, jeffrey mclurkin <jeffrey.mclurkin at gmail.com> wrote:> > When I click a link to download a file, a pop up window comes up to save > the file. Is there a way to enter a file name and click the submit button > with mechanize?Mechanize normally won''t automatically save the file for you. If you "click" the file you want to save, then call "save_as" on it, passing in a string, it will save the file as the string you passed in. For example: page = agent.get(''some_url'') file = page.click(''some_link'') file.save_as(''my_file.txt'') -- Aaron Patterson http://tenderlovemaking.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mechanize-users/attachments/20070713/6510bbad/attachment.html
Quoting Aaron Patterson <aaron.patterson at gmail.com>:> On 7/12/07, jeffrey mclurkin <jeffrey.mclurkin at gmail.com> wrote: >> >> When I click a link to download a file, a pop up window comes up to save >> the file. Is there a way to enter a file name and click the submit button >> with mechanize? > > > Mechanize normally won''t automatically save the file for you. If you > "click" the file you want to save, then call "save_as" on it, passing in a > string, it will save the file as the string you passed in. For example: > > page = agent.get(''some_url'') > file = page.click(''some_link'') > file.save_as(''my_file.txt'') > >This looks like a great example to have in your set of examples. Mike B. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.