Fill a form and validate it with HTTPUNIT

Help
2007-03-01
2013-04-26
  • richardaniel

    richardaniel - 2007-03-01

    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("http://www.xxx.com");
    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();

    by

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

    In this situation, the submitRequest method is declared undefined.

    Is someone can help me?

    Thank you very much

    RICHARD (From france)

     
    • Fei Yang

      Fei Yang - 2007-03-11

      Should "wresponse = submitRequest(req);" be "wresponse = wform.submitRequest(req); " ?

       
    • richardaniel

      richardaniel - 2007-03-20

      Thank you for your proposal, submitRequest is not visible with wform, thus that don't work too.

      Richard

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks