Skip to content

Is the new attachment handler filename method working? #789

Description

@skyhirider

I am testing the new method that is supposed to work with the filename - handleAttachment(Page page, String attachmentFilename) .

When I

I noticed this while looking at implementing an attachment handler that would download all attachments automatically to a temporary folder.

Are you open to adding an extra attachment handler to HtmlUnit in addition to the Collecting attachment handler? I can build one (provided the attachment handler is working correctly)

My very ugly work in progress test.

The attachment handler I am using is an empty class, but noticed the problem mentioned above while debugging.

	@Test
	public void test() throws FailingHttpStatusCodeException, MalformedURLException, IOException, InterruptedException {
		System.out.println(System.getProperty("java.io.tmpdir"));
		WebClient webClient = new WebClient(BrowserVersion.FIREFOX);
		webClient.setAttachmentHandler(new DownloadingAttachmentHandler());
		HtmlPage page = webClient.getPage("https://www.ronsplace.ca/products/ronsdataedit/download");
		HtmlAnchor anchorByHref = page.getAnchorByHref("/contentproduct/data-edit/setup.exe");
		System.out.println(anchorByHref.asXml());
		anchorByHref.click();
		
		Thread.sleep(100000);
		
	}

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions