9

I need to save files from websites Using HtmlUnit. I am currently navigating to pages that have several anchors that use javascript onClick()="DownloadAttachment('attachmentId')" to get the files. The files can be of pretty much any type ( xls, doc, txt, pdf, jpg, etc). So far though I've been unable to find resources or examples that show how to save files using htmlUnit. I've been trying mainly to get AttachmentHandler to work for this as it seems the most likely to work, but have been unsuccessful. I was wondering if anyone else has managed to download files using HtmlUnit and could assist?

Servy
  • 202,030
  • 26
  • 332
  • 449
TheBeeKeeper
  • 225
  • 2
  • 12
  • 2
    Source for `AttachmentTest.java`: https://htmlunit.svn.sourceforge.net/svnroot/htmlunit/trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/attachment/AttachmentTest.java – miku Jun 27 '11 at 18:17
  • 11
    @TheBeeKeeper: can you please answer the question yourself and then accept that answer? Also, you need to accept answers to previous questions if they fix your problem. – Zecas May 17 '12 at 11:59
  • 2
    For all the people who are confused: The answer to the question is here: http://stackoverflow.com/posts/6497098/revisions – Aaron Digulla Feb 12 '14 at 15:46
  • I copied the question and answer to: http://stackoverflow.com/questions/21758258/htmlunit-and-javascript-in-links – Aaron Digulla Feb 13 '14 at 15:22

0 Answers0