Login

Login
  • Register
  • VectorDesign blog

    Testing Automation and general Tech Geek stuff

    Setting up Credentials for HtmlUnitDriver

    Posted in Selenium on 21 July 2015 by vectordesign
    TestVariables.driver = new HtmlUnitDriver(true) {
    protected WebClient modifyWebClient(WebClient client) {
    // This class ships with HtmlUnit itself
    DefaultCredentialsProvider creds = new DefaultCredentialsProvider();
    
    // Set some example credentials
    creds.addCredentials("USERNAME", "PASSWORD");
    
    // And now add the provider to the webClient instance
    client.setCredentialsProvider(creds);
    
    return client;
    }
    };
    

    Leave a Reply