-
-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Description
I am testing the new method that is supposed to work with the filename - handleAttachment(Page page, String attachmentFilename) .
When I
- open this page https://www.ronsplace.ca/products/ronsdataedit/download
- click the download free link
the filename remains null during debug even thou the header contains "filename=RonsDataEdit_2024.05.15.1304_setup.exe"
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);
}Metadata
Metadata
Assignees
Labels
No labels