• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Form submit using HttpUnit

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I tried submitting a form using the following code

String url = protocol + "://" + hostname + ":" + port + path;
WebRequest webRequest = new GetMethodWebRequest(url);
WebResponse webResponse = webConversation.getResponse(webRequest);
webResponse = webConversation.getCurrentPage();
WebForm form = webResponse.getFormWithName("logonForm");
form.setParameter("password", password);
form.setParameter("username", username);
form.submit();

where "logonForm" id the form's name in the JSP.

Now i expect that the browser should go to Inbox Jsp. Thew title of that JSp is "Inbox" only. When i say assertEquals("Inbox",webResponse.getTitle)());
The test fails.
So any one knows what could be the problem.

Pls help
Shrikant
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What failure message do you get?

Did you notice that form.submit() returns a new WebResponse?
 
Shrikant Kulkarni
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Yah i have already tried that. But the real problem is,
after submitting the logonForm page, the control goes to Check_password_expiry.jsp page. After that it has to go to Inbox page. But through test case i am unable to go to Inbox page.
So how to forward the control to Inbox page?
Pls any help.

Thanks well in advance.

Shrikant
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is the forwarding implemented?
reply
    Bookmark Topic Watch Topic
  • New Topic