submit html form programmatically in android
- by Maneesh
I want to submit form programatically in android. I don't want any user interaction with web browser. User will provide inputs in EditField and then inputs will be submitted thru httppost method via HTTPwebmethod. But I didn't get any success in the same. Please advise. I have used HTMLUnit in java but its not working android.
final WebClient webClient = new WebClient();
final HtmlPage page1 = webClient.getPage("http://www.mail.example.com");
final HtmlForm form = page1.getHtmlElementById("loginform");
final HtmlSubmitInput button = form.getInputByName("btrn");
final HtmlTextInput textField1 = form.getElementById("user");
final HtmlPasswordInput textField2 = form.getElementById("password");textField1.setValueAttribute("user.name");
textField2.setValueAttribute("pass.word"); final HtmlPage page2 = button.click();