Skip to content

Instantly share code, notes, and snippets.

@harsha509
Created May 14, 2024 10:40
Show Gist options
  • Save harsha509/6a8c7ada90a83040e4f85e8bafa9938b to your computer and use it in GitHub Desktop.
Save harsha509/6a8c7ada90a83040e4f85e8bafa9938b to your computer and use it in GitHub Desktop.
void canContinueWithAuthCredentials() {
try (Network network = new Network(driver)) {
network.addIntercept(new AddInterceptParameters(InterceptPhase.AUTH_REQUIRED));
network.onAuthRequired(
responseDetails ->
network.continueWithAuth(
responseDetails.getRequest().getRequestId(),
new UsernameAndPassword("admin", "admin")));
driver.get("https://the-internet.herokuapp.com/basic_auth");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment