Hi there,

The page I'm trying to login redirects from a https:// site to a http://
(actually post a form to a http://), and than again to the same https://

In the first redirect the HttpUnit loses my proxy properties and throw an
Http 407 Exception (Proxy Authentication Required)... the code is:

    public TestRobot() {
        super();
        getTestContext().setBaseUrl("https://www.mysite.com";);
        getTestContext().setProxyName( "myProxyServer" );
        getTestContext().setProxyPort( 8080 );
        getTestContext().setAuthorization( "proxyuser", "proxypass" );
        HttpUnitOptions.setScriptingEnabled( false );
    }

    public void loginSite() {
        try
        {
            beginAt("/login.asp");
          assertFormPresent( "Form" );
            assertFormElementPresent( "username" );
            assertFormElementPresent( "password" );
            getDialog().getForm().setParameter( "username", "myuser" );
            getDialog().getForm().setParameter( "password", "mypass" );
            submit();

      // at this point it loads a page that post to a http://www.mysite.com
            assertFormPresent( "newForm" );

            System.out.println(
getDialog().getForm().submitNoButton().getText() );

        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }


And the exception is:

com.meterware.httpunit.HttpException: Error on HTTP request: 407 Proxy
Authentication Required [http://www.mysite.com/content.asp]
      at
com.meterware.httpunit.WebClient.validateHeaders(WebClient.java:577)
      at com.meterware.httpunit.WebClient.updateClient(WebClient.java:464)
      at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:139)
      at
com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:130)
      at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:121)
      at com.meterware.httpunit.WebWindow.sendRequest(WebWindow.java:110)
      at
com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:253)
      at
com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
      at com.meterware.httpunit.WebForm.submitRequest(WebForm.java:96)
      at com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:107)
      at com.meterware.httpunit.WebForm.submit(WebForm.java:69)
      at com.meterware.httpunit.WebForm.submitNoButton(WebForm.java:90)
      at test.TestRobot.loginSite(TestRobot.java:54)
      at test.Main.main(Main.java:26)



Please, Can anybody help me????

Thanks!!!

Eduardo

This message is intended solely for the use of its addressee and may
contain privileged  or confidential information.
If you are not the addressee you should not distribute, copy  or file this
message.
In this case, please notify the sender and destroy its contents
immediately.

Esta mensagem � para uso exclusivo de seu destinat�rio e pode conter
informa��es privilegiadas e confidenciais.
Se voc� n�o � o destinat�rio n�o deve distribuir, copiar ou arquivar a
mensagem.
Neste caso, por favor, notifique o remetente da mesma e destrua
imediatamente a mensagem.



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Jwebunit-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to