Headless mode in chrome 97 is not working with windows auth - google-chrome

I use windows auth on build agent on teamcity
chromeOptions.AddArgument("--auth-server-whitelist=*");
chromeOptions.AddArgument("--auth-negotiate-delegate-whitelist=*");
And run autotests in headless mode.
chromeOptions.AddArgument("headless");
chromeOptions.AddArgument("window-size=1920x1200");
chromeOptions.AddArgument("--no-sandbox");
Everything has been working fine until Chrome was auto-updated to 97 version. After that my windows auth just stopped working(but it still works for runs without headless mode). I installed old Chrome version on my agents and it works again. But I want to continue both - get updates to Chrome and run my autotests in headless mode.
I tried to add some extra arguments but they didn't work.
options.addArguments("--window-size=1920,1080");
options.addArguments("--disable-gpu");
options.addArguments("--disable-extensions");
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments("--proxy-server='direct://'");
options.addArguments("--proxy-bypass-list=*");
options.addArguments("--start-maximized");
options.addArguments("--headless");
Any idea how to fix this issue?

The Chrome command line arguments changed from whitelist to allowlist:
https://www.ibm.com/support/pages/change-kerberos-windows-authentication-registry-settings-chrome-and-edge-sso
Making that change seems to work for me.

Related

Using VSCode WSL Remote, why won't Chrome Debugger launch Chrome for Windows?

I'm switching to VSCode WSL Remote mode for a JavaScript project. The Chrome Debugger Extension always look for Google Chrome in Linux. Is this the correct behavior?
I have a Chrome for Linux installed in WSL, which could run on X server. The problem is that the breakpoints are not working.
I've tried removing Chrome in WSL, the extension will then throw Can't find Chrome - install it or set the "runtimeExecutable" field in the launch config.
Should I set "runtimeExecutable" to chrome.exe or force it to run on local side with
"remote.extensionKind": {
"msjsdiag.debugger-for-chrome": "ui",
}
Could I correct some config so that the Chrome Debugger can find the Chrome in Windows if there's no Linux install?
Is there any official guide for it?
Thanks!
Yes, you should set
"remote.extensionKind": {
"msjsdiag.debugger-for-chrome": "ui"}
An alternative would be to set an alias chrome to go to chrome.exe in Windows. To ensure persistence, add it to your ~.bashrc or shell equivalent or alternatively .profile.
Side note: you should be able to debug with the new chromium-based Edge as well if you prefer using that.

Does headless Chrome auto update?

Does Chrome update itself when running in headless mode by selenium?
It seems, it is not updating, probably because of --disable-background-networking switch set by Selenium by default. I want to ensure that's indeed the case. If there any reference in documentation explaining either auto-update behavior or meaning of switches and their impact? So far best I've found is list with all command line Chrome switches with some comments, but it is still not clear.
No, Chrome Browser Client doesn't update itself when running in headless mode by selenium.
As per Getting Started with Headless Chrome the Headless Chrome is the server environment where you don't need a visible UI shell.
If you've got Chrome 59+ installed, you start Chrome with the --headless flag as follows:
chrome \
--headless \ # Runs Chrome in headless mode.
--disable-gpu \ # Temporarily needed if running on Windows.
chrome should always point to your installation of Chrome. Of course, the exact location varies from platform to platform.
So until and unless the original Chrome Browser is automatically/manually updated, Chrome Browser Client doesn't get updated.
TL;DR
--disable-background-networking is configured to disable several subsystems which run network requests in the background. This is used when performing network performance testing in order to avoid noise in the measurements.

Chrome headless not completing, ever (Windows)

I'm struggling to get Chrome headless to do absolutely anything.
I've tried the simple 'getting started' here: https://developers.google.com/web/updates/2017/04/headless-chrome
This example: chrome --headless --disable-gpu --screenshot https://www.chromestatus.com/
does nothing for me. No screenshot generated in the folder. (Was running CMD as Admin).
I've created a webapp (running in IIS on my PC) and set a breakpoint on its Index page. When I call the app using Chrome headless the breakpoint is triggered, but my 2nd (Console) app which created the Chrome headless instance never proceeds beyond the 'Navigate()' line.
The code from the console app:
IWebDriver webClient;
ChromeOptions option = new ChromeOptions();
option.AddArguments("--headless", "--disable-gpu", "--window-size=1920,1200", "--ignore-certificate-errors", "--no-sandbox");
webClient = new ChromeDriver(option);
webClient.Navigate().GoToUrl("http://localhost:49709/");
((ITakesScreenshot)webClient).GetScreenshot().SaveAsFile("ChromeScreenshot.png", ScreenshotImageFormat.Png);
Running:
Windows 7 64-bit
Chrome 64-bit 66.0.3359.139
ChromeDriver 2.38
What am I missing?
I've figured out what is causing the issue, but not why or a proper fix for it. Writing this here in case it helps someone in future.
I found by chance that a timeout error would eventually be thrown after 60 seconds:
The HTTP request to the remote WebDriver server for URL http://localhost:51660/session timed out after 60 seconds.
This error was being thrown on the creation of the ChromeDriver object. Note this is an error thrown by Selenium trying to communicate with the Chrome WebDriver, NOT the Navigate() command failing.
I discovered by complete chance that by removing the "--headless" parameter from the options makes everything works fine. I also found that another parameter "--remote-debugging-port=9222" causes it to fail completely, too.
I'm currently assuming these issues are specific to my environment rather than a bug in the ChromeDriver. But, still looking.

Chrome Headless Doesn't work

I've read about the Chrome Headless from developers.google said we can run the Google without UI. Quote from that link :
Headless Chrome is shipping in Chrome 59. It's a way to run the Chrome
browser in a headless environment. Essentially, running Chrome without
chrome! It brings all modern web platform features provided by
Chromium and the Blink rendering engine to the command line.
Why is that useful?
A headless browser is a great tool for automated testing and server
environments where you don't need a visible UI shell. For example, you
may want to run some tests against a real web page, create a PDF of
it, or just inspect how the browser renders an URL.
This is really great feature, so I do some experiment with this cool feature. The idea is to taking snapshot as the document site by do call of chrome.exe from Windows Command Prompt, as follow :
chrome --headless --disable-gpu --screenshot https://www.chromestatus.com/
After do several times and following the instruction from these site. I got nothing. I don't get any picture or screenshot with name screenshot.png as document mention it before Running with --screenshot will produce a file named screenshot.png in the current working directory.
From this document also said about version,
Caution: Headless mode is available on Mac and Linux in Chrome 59.
Windows support is coming in Chrome 60. To check what version of
Chrome you have, open chrome://version.
after do some check with suggested before, I run chrome://version on my Chrome on Windows x64 Machine and got some result :
Google Chrome 62.0.3202.94 (Official Build) (64-bit) (cohort: Stable)
Revision 4fd852a98d66564c88736c017b0a0b0478e885ad-refs/branch-heads/3202#{#789}
What wrong? What i missed?
Thanks
After do some experiments. for --screenshot will save the image on the same level as chrome.exe location and that will be mean save on Program Files.
So we need need to combine parameter names and arguments with a =
--screenshot="D:\screen.png" will work, otherwise Chrome writes to it's installation folder. Big design flaw, no software should use it's installation folder as a working directory.
Here are the complete argument :
chrome --headless --enable-logging --disable-gpu --screenshot="D:\screen.png" "https://www.chromestatus.com/"

--disable-web-security not working anymore in Chrome 30

I updated Google Chrome to Version 30.0.1599.69 m. Now the "--disable-web-security" flag is not working. How do I to disable the websecuritiy in Google chrome Version 30.0.1599.69 m
I think the problem is with the chrome instance running in the task bar.
Please check whether any other instance of the Chrome is running in
the task bar. Even a single instance will not let chrome reflect the
command.
Kill all and then try running this command again.
extend disable web security command with --user-data-dir. This worked for me, more details are on >https://bugs.chromium.org/p/chromium/issues/detail?id=575690
Command I use in windows :
"C:\Users\Public\Desktop\Google Chrome.lnk" --disable-web-security --user-data-dir