New issue
Advanced search Search tips

Issue 747384 link

Starred by 2 users

Issue metadata

Status: Unconfirmed
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Chrome loses user credentials when in headless mode

Reported by krystian...@gmail.com, Jul 21 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.72 Safari/537.36

Steps to reproduce the problem:
Running Chrome in headless mode:
var chromeOptions = new ChromeOptions{
    BinaryLocation = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"/AppData/Local/Google/Chrome SxS/Application/chrome.exe"
};
chromeOptions.AddArguments(new List<string>() { "headless", "disable-gpu", "no-sandbox" });
var driver = new ChromeDriver(chromeOptions);
driver.Navigate().GoToUrl(mainPageURL);

What is the expected behavior?
I'm trying to set up headless chrome for CI selenium testing. Our webservice is using AD for authorization. For whatever reason when chromedriver is set to headless mode it gets "Access is Denied - 401.2" when trying to acces any of our service's pages. But as soon as I launch it normally (with window as opposed to headless), everything works fine.

What went wrong?
After trying to run any tests with this setup (and getting 401.2) IIS logs something like this:
2017-06-23 11:25:12 ::1 GET / - 39731 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+HeadlessChrome...

But as soon as I remove "headless" from arguments, logs look like this:
2017-06-23 11:26:15 ::1 GET / - 39731 [USER_LOGIN] ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome...

With my login in place of [USER_LOGIN].

Did this work before? No 

Does this work in other browsers? Yes

Chrome version: 61.0.3163.0  Channel: dev
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 
Components: Internals>Headless
Thanks for the report. 

You can check  crbug.com/721739  where selenium currently doesn't support certificate errors (this could be a workaround)

As for why you are actually getting the cert error: 
- Have you tried setting the user-data-dir to your directory in Chrome? It could be that it's trying to look for your credentials in your profile directory. Note that headless doesn't use the same user data dir as Chrome by default. 

- Since you are getting a 401.2 error it could be that it's missing some configuration to work on headless. You can also try setting those credentials alongside your requests

If all this fails, could you provide a simple use case that we can reproduce? 

Thanks!



Labels: TE-NeedsTriageHelp
adding TE-NeedsTriageHelp as this issue related to selenium we driver.
I don't think it is related to certificate errors because I go to http://localhost:85 not https://localhost:85, my app doesn't use https certs, the problem is related to AD automatic login

I tried setting the user-data-dir but with no success

"- Since you are getting a 401.2 error it could be that it's missing some configuration to work on headless. You can also try setting those credentials alongside your requests"

What configuration is missing?

chromeOptions.AddArguments(new List<string>() { "headless", "disable-gpu", "no-sandbox" });
Any progress? Still can't use Windows Integrated Autentication with headless mode
I'm seeing this issue as well. Similar use-case. We start the chromedriver.exe process under different credentials and in headless mode from within our test tooling. When connecting to remote debugging port, we see:

Inspectable WebContents
401 - Unauthorized: Access is denied due to invalid credentials.

Without headless mode everything works as expected.

ChromeDriver v2.32.498550
Chrome v62.0.3202.62
Labels: -Hotlist-Interop

Sign in to add a comment