Selenium forgets the authentication



  • I'm using Selenium and Java to automate tests.

    When opening the page under test, Chrome performs basic authentication (prompts for username/password). However, authentication should be solved on the domain level.

    When opening the browser manually, I'm not prompted for credentials.

    I tried to force Chrome to use the default profile with following ChromeOptions:

    ChromeOptions options = new ChromeOptions();
    options.addArguments("--user-data-dir=C:\Users\my-username\AppData\Local\Google\Chrome\User Data\Default");
    

    But no luck. What am I doing wrong?



  • Selenium can be flaky with auto authentication.

    The simple solution is you're better off just altering the URL to include it.

    e.g. https://username:password@url.com



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2