armando p - 2005-07-11

Hello everyone. Had a quick question.  I've been following a few threads and have started testing my own httpunit form submitter.  Below is the code. 

1.  The problem im having is that the form does not seem to log me into the system once i click on submit.
2.  Am I calling the right sequence of commands to get the logged in page's html?
3.  Does the below code keep its session state?

I know this is alot to ask, but thanks again.  Have been looking for a solution to my problem for the last week.
 

WebClient client = new WebConversation();

      //Set client settings;
      client.getClientProperties().setUserAgent("Mozilla 1.0");
      client.getClientProperties().setAutoRedirect(true);
      client.getClientProperties().setAutoRefresh(true);
      client.getClientProperties().setAcceptCookies(true);

      WebRequest request = new GetMethodWebRequest("http://www.sometestsite.com?_var=123");
      WebResponse response = client.getResponse(request);

      //----------
      WebForm form = client.getCurrentPage().getFormWithName("exampleform");
      if(form.hasParameterNamed("email") && form.hasParameterNamed("password")){

        form.setParameter("password", "password");
        form.setParameter("email", "test@test.com");
        response = form.submit();
        System.out.println(response.getText());

      }//End if

Now here is the html im using.
<form method="post" action="test2.php" name="exampleform">
email <input type="text" name="email" />
password <input type="text" name="password" />
<input type="image" name="SubmitBtn" value="LOG-IN" src="images/testerbtn.gif">
</form>