Skip to content Skip to sidebar Skip to footer

Htmlunit And Javascript In Links

Copied from here: I need to save files from websites using HtmlUnit. I am currently navigating to pages that have several anchors that use javascript: onClick()='DownloadAttachmen

Solution 1:

It's more simple than that. Just simulate the click event and then get the WebResponse:

HtmlElement anchorAttachment = (HtmlElement) pageETrackerItem.getByXPath(".../a").get(0);

InputStream is = anchorAttachment.click().getWebResponse().getContentAsStream();

Post a Comment for "Htmlunit And Javascript In Links"