Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fill a form and validate it with HTTPUNIT

Status
Not open for further replies.

RichardDeray

IS-IT--Management
Mar 8, 2004
4
FR
Hi,

I use HTTPUNIT for filling fields in a form and validate it. Until today, I used the 5 following code lines and that worked fine :

WebResponse wresponse = wc.getResponse("WebForm wform = wresponse.getForms()[0];
wform.setParameter("code","1234");
wresponse = wform.submit();
wresponse = wc.getCurrentPage();

But now I need to add a method to stop HTTPUNIT to control the datas set in the "setParameter" méthod.
For this reason, I used the newUnvalidatedRequest(); method.

Then I replaced the 2 above code lines :

wform.setParameter("code","1234");
wresponse = wform.submit();

with

WebRequest req = wform.newUnvalidatedRequest();
req.setParameter("code","1234");
wresponse = submitRequest(req);

In this situation, the submitRequest method is declared undefined.

Is someone can explain me why?

Thank you very much

RICHARD
 
Because the class you're using doesn´t have a submitRequest method.

Cheers,
Dian
 
Hi,

Ok, but how can I use newUnvalidatedRequest method before validate a form to avoid control of the contain of the field with httpunit?

RICHARD (From france)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top