4

I am creating a submit button using a web client, but it's not working.

This is the code, which I am 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();
Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
narendra
  • 451
  • 3
  • 12

1 Answers1

1

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

HtmlUnit, how to post form without clicking submit button?

Community
  • 1
  • 1
Satheesh Cheveri
  • 3,621
  • 3
  • 27
  • 46