code: public void authenticateOnNextAlert(String username, String password) {
  		Credentials credentials = new UserAndPassword(username, password);
  		Alert alert = driver.switchTo().alert();
  
  		alert.authenticateUsing(credentials);
  	}
docs: Authenticates the user using the given username and password. This will
  work only if the credentials are requested through an alert window.
  
  @param username
  the user name
  @param password
  the password