From: Zhenrong L. <Zhe...@sa...> - 2005-03-10 14:02:32
|
Hey, I'm new to htmlunit and have a test scenario like this, every time when = I click a link, a window will pop up ask me to enter userid and = password. I tried to find a way to do this using Htmlunit1.4 but no = success, I was wondering if there is something missing? Or I totally = used the wrong API? My code: .... final WebClient webClient =3D new WebClient(); final URL url =3D new = URL("http://localhost:8080/SASStoredProcess/do?_program=3D//Webapp/Proper= tySheet/stpint_1&_action=3Dproperties"); final SimpleCredentialProvider scp =3D new = SimpleCredentialProvider("Domain\myuserid", "mypassword"); webClient.setCredentialProvider(scp); final HtmlPage page1 =3D HtmlPage)webClient.getPage(url);=20 .... It gives me the following errors: Mar 8, 2005 3:00:21 PM = org.apache.commons.httpclient.auth.AuthChallengeProcessor = selectAuthScheme INFO: basic authentication scheme selected Mar 8, 2005 3:00:21 PM org.apache.commons.httpclient.HttpMethodDirector = processWWWAuthChallenge INFO: No credentials available for BASIC 'SAS Authentication Domain: = DefaultAuth'@localhost:8080 But in Jwebunit, I can easliy solve this using=20 HttpUnitDialog hud =3D getDialog(); WebClient wc =3D hud.getWebClient(); wc.setAuthorization(username, password); I was wondering if someone can give me some hints here.=20 Thanks, -Zhenrong |