submit html form programmatically in android
Posted
by Maneesh
on Stack Overflow
See other posts from Stack Overflow
or by Maneesh
Published on 2010-06-01T12:43:59Z
Indexed on
2010/06/01
13:13 UTC
Read the original article
Hit count: 837
android
|android-emulator
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();
© Stack Overflow or respective owner