From: Brad C. <yo...@br...> - 2005-03-10 19:20:20
|
This has been changed in CVS: INCOMPATIBLE CHANGE: com.gargoylesoftware.htmlunit.CredentialProvider has been removed. You should now use org.apache.commons.httpclient.auth.CredentialsProvider instead. This patch should allow support for NTLM and Digest authentication as well as proxy authentication. Thanks to Daniel Gredler . http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/DefaultCredentialsProvider.html --- Zhenrong Liu <Zhe...@sa...> wrote: > 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 = new WebClient(); > final URL url = new > URL("http://localhost:8080/SASStoredProcess/do?_program=//Webapp/PropertySheet/stpint_1&_action=properties"); > final SimpleCredentialProvider scp = new > SimpleCredentialProvider("Domain\myuserid", "mypassword"); > webClient.setCredentialProvider(scp); > final HtmlPage page1 = HtmlPage)webClient.getPage(url); > .... > > 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 > HttpUnitDialog hud = getDialog(); > WebClient wc = hud.getWebClient(); > wc.setAuthorization(username, password); > > I was wondering if someone can give me some hints here. > > Thanks, > -Zhenrong |