Menu

button.click() & form.submit() failing

Help
2004-10-21
2013-04-26
  • Jason B. Archibald

    In view of the other posts relating to this, I have found several of my scripts that run fine with version 1.5.4, now fail with version 1.6.

    there is no javascript on the page referenced. here is a snippit of the code.

    HTML
    <form name="Form" method="POST" action="Payment1?action=preview">

    ...  form stuff.. ..

    <input type="image" name="action" src="prev.gif" alt="Preview Request" border="0" value="PreviewRequest">.
    </form>

    then, in my code I simply get the form and try to submit it.

    WebForm form = getForm( "Form" );
    form.submit();
    /// this fails with 1.6, but worked with 1.5.4

    so I tried the following

    SubmitButton button=form.getSubmitButton("action");
    System.out.println(button.toString());
    form.submit(button);

    My System.out.println returns,
    Submit with action=PreviewRequest
    Which is exactly what it should find.  but still the form is not getting submitted.

    Any ideas .. anybody?

    Jason

     
    • Ralf Bust

      Ralf Bust - 2005-02-09

      I had a similar problem.

      Try to use a Button and not a SubmitButton.
      The behavior changed in httpunit 1.6

      -- snip --
      Button[] buttons = form.getButtons();

          try{
            buttons[0].click();
          }
          catch(Exception sax_ex){
            throw new Exception("blubber");
          }
      -- snip --

       

Log in to post a comment.

MongoDB Logo MongoDB