I’m trying to modify a request made by HtmlUnit before it gets sent out, I did a lot of Googling and found this in their FAQ
http://htmlunit.sourceforge.net/faq.html#HowToModifyRequestOrResponse
How to modify the outgoing request or incoming response? You can
subclass HttpWebConnection and override getResponse() as:new WebConnectionWrapper(webClient) { public WebResponse getResponse(WebRequest request) throws IOException { WebResponse response = super.getResponse(request); // modify the response by creating a new WebResponse return response; } };
I’m trying to modify the request after clicking a submit button like the example below
page = submitButtonSend.click();
How should this be written so I can modify the outgoing request before it gets sent out?
1 Answer