Chrome headless not completing, ever (Windows) - google-chrome

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.

Related

Headless mode in chrome 97 is not working with windows auth

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.

Puppeteer authentication does not work in headless mode but yes in non headless mode

I'm facing up a strange problem in Puppeteer with authentication.
I've written a script to take some screenshot of a website which required authentication.
In my local computer (windows), when running in command line as node.exe my_script.js; it's working fine (in headless moden which is the default mode).
I've written an upper Java program to manipulate it (dynamically set the path, the node modules path, run the process "nodex.exe my_script.js" every 30minutes, manage timeout of the process,...). It's still working directly running from Eclipse, in headless mode.
Then... I've built/packaged a JAR and running it in a cmd window: java -jar my_jar.jar... and then the script can't authentitcated on the website in headless mode (the answser page just write a message like "you need to be authenticated", which is managed by the http server).
To check what happen, I've just add an option in my nodejs script (so I do not modify my java upper program code) to run chrome in non headless mode; with option headless : false. And... it's working!
I let the option to run in non headless mode, and I create a Windows service to run my jar via a bat file, with the help of nssm... Just to test. I'm really happy to see that all is running fine without seeing any chrome GUI (maybe Windows disable GUI for service, don't know how).
Have I maybe missed something? Or is there a bug in Puppeteer or Chrome to manage authentication in headless mode?
Regards
Alex

While using Selenium and chromedriver in JMeter, I get an error on chrome

I have inherited a JMeter performance testing script. There is a chromedriver section and an HTTPSampler section. The httpsampler section works fine. The chromedriver section runs into a problem. When I run it chrome pops up like this:
It does not move forward with any of the steps in the plan after that. Up until recently I've also been seeing the error
Error communicating with the remote browser. It may have died.
I am not seeing this now, so I don't know if it's just a difference in how the test is running or what.
The person I inherited this from was running it on a mac and did not get any of these problems. I saw it run with no errors at the same time I was getting them.
One solution I found was to add the --test-type flag to chromedriver. Unfortunately I cannot find a way to add that argument when running it through JMeter. I've tried adding both --test-type and -test-type to the end of the path to chromedriver.exe, but that did not work.
Does anyone have a solution for this?
The error might be due to conflict in chrome driver version. Please install the latest version of ChromeDriver from this link.
Latest version of Chrome Driver supports the browser version v56-58.

Chromedriver.exe has stopped working when run from cmd

We were trying to add some selenium scripts on Jenkins but whenever we gave the command I was receiving an error "Chromedriver.exe has stopped working".
I moved chromedriver to another location, such as C:, to test it and I found that if I manually doubleclick it from the folder is working fine. But whenever I try to start it from the command prompt is giving me the error "Chromedriver.exe has stopped working".
Any ideas?
Environment: Windows 10 64bit
I have experienced the same issue. In my case it was explicit .quit() missing. This was only case with 32-bit Python, 64-bit Python was working fine even without it.
browser = webdriver.Chrome()
browser.get(url)
#do some work with the downloaded contents
browser.quit()

WebStorm debug mode not working and get message Process finished with exit code -1073741819 (0xC0000005)

I have recently downloaded WebStorm 11.0.3 to run my Protractor test cases. My test cases run fine when run normally (i.e. run from run configurations) but when I try to run my test cases in debug mode nothing really happens and I get the following in the console:
"C:\Program Files (x86)\JetBrains\WebStorm 11.0.3\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" --debug-brk=58467 --nolazy c:\Users\daobrien15\AppData\Roaming\npm\node_modules\protractor\lib\cli.js conf.js
Debugger listening on port 58467
Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Process finished with exit code -1073741819 (0xC0000005)
When I run debug against Firefox it just launches the first run Firefox screen and does nothing. When I run it against Chrome it just loads a blank page with data:, in the URL bar and also does nothing.
I am using the following:
OS: Win 7 (64 bit)
Protractor: 3.0.0
Selenium webdriver: 2.48.2
Firefox: 35 as the latest was not working with my tests when run normally
Chrome: 47.0.2526.111 m (Latest)
Also I am running my selenium webmanager through the console. I get pretty much the same result if I use the directConnect option in my conf.js file:
directConnect: true,
Any help would be greatly appreciated.
I have had same problem.
Check version of node.js in your webstorm terminal: node --version
My version was 5.2 and I had this bug.
Today I update node to 5.5.0(last stable) and this problem gone.
NOTE: If you use Webstorm 9 or 10 go to
C:\Program Files (x86)\JetBrains\WebStorm 9.0\bin
and open WebStorm64.exe.vmoptions and WebStorm.exe.vmoptions and in the end set
-Dnodejs.debugger.use.jb.support=false
this will help to stop on your breakpoint.
If you use Webstorm 11 you will not have this problem, but if you will - use fix for WebStorm 9/10.
Hope this will help you.
I have had some problem. I was tried #user3552 solution but not worked for me second time. I checked my node params and removed this param from my node params. This is working now.
--debug-brk=8081
Before removing one param my exec code was like this
/home/veysel/.nave/installed/5.0.0/bin/node --debug-brk=37621 -debug-brk=8081 --expose_debug_as=v8debug /opt/lampp/htdocs/kart/server.js 8080
After removing the last exec code like this.
/home/veysel/.nave/installed/5.0.0/bin/node --debug-brk=37621 --expose_debug_as=v8debug /opt/lampp/htdocs/kart/server.js 8080