Posting data using the web client

I am creating a submit button using the web client, but it does not work.

This is the code I'm using:

 HtmlElement button = firstPage.createElement("button");
 button.setAttribute("type", "submit");
 button.setAttribute("name", "submit");
 form.appendChild(button);
 System.out.println(form.asXml());
 HtmlPage pageAfterLogin = button.click();
+5
source share
1 answer

Simple question. Do you have an HTML FORM tag included in the page? Also see the link below, not sure if it will help you.

HtmlUnit, how to submit a form without clicking the submit button?

+1
source

All Articles