如何使用HtmlUnitDriver处理身份验证?
在Java中尝试这个似乎对我有用
WebDriver driver = new HtmlUnitDriver() { 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; } };