Good morning.
I'm trying to block a specific script in HtmlUnit (Java) that is not letting other information access, I've tried this code, but when I give a print page.asXml () it continues to block page content.
Code used:
WebClient web = new WebClient(BrowserVersion.CHROME);
new FalsifyingWebConnection(web) {
@Override
public WebResponse getResponse(WebRequest settings) throws IOException {
System.out.println(settings.getUrl().toExternalForm());
if (settings.getUrl().toString().contains("js/visualizador-pdf.js?")) {
return createWebResponse(null, "", "text/javascript");
}
return super.getResponse(settings);
}
};
Thank you!