title: Selenium Chrome 60 Headless Handle Basic Authentication SAML Dialog over HTTPS
body: <p>Chrome 59 <a href="https://www.chromestatus.com/feature/5669008342777856" rel="noreferrer">removed support for https://user:password@example.com URLs</a>.</p>
  
  <p>I have a C# selenium test that needs to work with <a href="https://developers.google.com/web/updates/2017/04/headless-chrome" rel="noreferrer">Chrome Version 60 on Windows in '<strong>headless</strong>' mode</a> </p>
  
  <pre><code>ChromeOptions options = new ChromeOptions();
  options.AddArgument("headless");
  driver = new ChromeDriver(chrome, options);
  </code></pre>
  
  <p>Here is the SAML authentication required dialog I am trying to handle on Windows:
  <img src="https://i.stack.imgur.com/lAGPZ.png" alt="Basic Auth Dialog"></p>
  
  <p>Based on the answer given here: <a href="https://stackoverflow.com/questions/24304752/how-to-handle-authentication-popup-with-selenium-webdriver-using-java">How to handle authentication popup with Selenium WebDriver using Java</a>) I can see several workarounds for handling this in FireFox, but nothing for Chrome 60 in headless mode. </p>
  
  <p>I've tried the following code to visiting a URL with credentials before visiting the URL under test (without credentials) however it appears there is a <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=435547#c33" rel="noreferrer">bug</a> with Chrome 60. </p>
  
  <pre><code>goTo("http://user:password@localhost"); // Caches auth, but page itself is blocked
  goTo("http://localhost"); // Uses cached auth, page renders fine
  // Continue test as normal
  </code></pre>
  
  <p>I can see the following code in <strong>Firefox</strong> handles the authentication and the dialog never pops up:</p>
  
  <pre><code>FirefoxProfile profile = new FirefoxProfile();
  profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", "https://saml.domain.com");
  profile.EnableNativeEvents = false;`
  </code></pre>
  
  <p>I've tried the second approach (<a href="http://learn-automation.com/handle-windows-authentication-using-selenium-webdriver/" rel="noreferrer">using AutoIt</a>) and that works on Chrome 60 but does <strong>NOT</strong> work on Chrome 60 in <strong>Headless</strong> mode.</p>
  
  <pre><code>//Use AutoIt to wait 4 seconds for the authentication required dialog to appear
  au3.Sleep(4000);
  //Use AutoIT to send in the credentials from app.config that are encrypted
  au3.Send(USERNAME + "{TAB}" + PASSWORD + "{ENTER}");
  //Refresh the page
  driver.Navigate().Refresh();
  </code></pre>
  
  <p>I am hoping there is a better solution now in 2017 and that there is an approach that will work with Chrome 60 in <strong>headless</strong> mode, any pointers?</p>
  
  <p>Just to be clear: Trying to use <a href="https://stackoverflow.com/questions/45328654/python-selenium-alert-prompt-username-password-is-not-working">embedded credentials</a> will NOT work using chrome v59+ because sub-resource requests will be blocked.</p>