Puppeteer authentication does not work in headless mode but yes in non headless mode - google-chrome

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

Related

How to add the chrome binary to run e.g. Karma tests on headless chrome on a CI server

I like to run my karma unit tests on a headless chrome. Using karma-chrome-launcher and setting the browser to "ChromeHeadless" works on my machine. But on the CI server it fails with the message "No binary for ChromeHeadless browser on your platform."
Installing chrome on the CI machine is not possible. Is there another way to load the chrome binaries?
for example the google puppeteer module seems to load that when run. from the docs: "Puppeteer downloads and uses a specific version of Chromium". How can i achieve the same?
You can use Puppeteer (headless Chromium), follow these instructions.
If what you fear is that download from the internet might be slow, you can tell puppeteer where to download chrome from and use a local address.
Use PUPPETEER_DOWNLOAD_HOST to specify where to download Chrome from and PUPPETEER_SKIP_CHROMIUM_DOWNLOAD to skip downloading Chrome altogether.
You can read more about this in the documentation.

PNaCl and Google Chrome 40 on Linux: Compile process could not be created

I am trying to run the part1 application in the getting_started directory of the Google Native Client SDK, and I obtain the following message in my browser:
NativeClient: PnaclCoordinator: Compile process could not be created:
When I visit the http://localhost:5103 I see the string "Loading...", but it never changes to "Success".
What do I need to configure in Chrome in order to be able to use Native Client applications?
My setup:
OS: Ubuntu Linux 12.04 LTS
Browser: Google Chrome 40
Pepper: 39
Root access: no
Not an answer, but a question:
Can you try to get some more log messages out of chrome or the NaCl runtime?
Start chrome from the shell with the environment variable NACLVERBOSITY=4 set. That asks chrome to show what is going on in the NaCl runtime when it has created a NaCl process (for the compiler). Typical messages are something like:
Entered NaClCreateServiceSocket
...
NaClSetUpBootstrapChannel
...
Elf header
...
and some more details. If that shows up, we know that NaCl compiler process creation at least made it that far. Could you then post the log somewhere, and I can take a look?
If it doesn't show up, then the problem is earlier in chrome. In this case, running chrome w/ --enable-logging=stderr -v1 (http://www.chromium.org/for-testers/enable-logging) might give some idea of what is going on in chrome before NaCl process creation.
Same issue.
I changed the chrome://flags settings for NaCl for debugging but we are not using the NaCl debugger at all. I set it back to default and it started working. (So I guess that was the problem?)

WebStorm debug mode doesn't hit breakpoints

I have WebStorm successfully launching my app when I hit debug. It runs the app in chrome and Chrome tells me that that tab is in debug mode.
But it will not break on any breakpoint. I am using Ext JS and in the root app.js I have a breakpoint on the launch: function (which is being called) and that does not drop me into the debugger.
Does the WebStorm debugger not work with Ext JS?
I have the same situation as yours, except that I'm building my app using Backbone.js and RequireJs and the app is running on localhost. My app can run in debug mode in Chrome but the breakpoints cannot be hit.
I solve the problem by mapping the Remote URL and my local directory. You can define this in your JavaScript debug configuration profile in the Run->Edit Configurations.
You can refer to this wonderful tutorial: Debugging your JavaScript app using WebStorm.
Happy debugging!

Chrome: Attaching nacl-gdb to packaged application loaded as an unpacked extension

I have built a simple NaCl application. For running the application I use technique 2 described in Nacl Developer's guide, which means that instead of running a local server I load my application as unpacked extension to chrome. The application runs fine so far.
Now I want to experiment with nacl-gdb and attach my application to it at startup.
In the NaCl Developer's guide there are only instructions on how to attach nacl-gdb on an application that is run with local server(technique 1). I made a search to the internet and I ended up with the following approach in order to attach nacl-gdb for an application that is being ran with technique 2:
I enabled "Native Client GDB-based debugging" flag of Chrome.
I started chrome from a terminal like this: ./chrome "--nacl-gdb=gnome-terminal --
/media/sdb1/leonidasbo/AncientRoot/nacl_sdk/pepper_27/toolchain/linux_x86_glibc/bin/x86_64-nacl-gdb"
When Chrome launched, I navigated to my application.
With this approach, Chrome automatically started nacl-gdb when I opened my application.
However nacl-gdb tried to attach but with no success. The output was the following:
*This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=x86_64-nacl".
Reading symbols from /opt/google/chrome/nacl_irt_x86_64.nexe...(no debugging symbols found)...done.
Don't know how to attach. Try "help target".
(gdb)*
It seems that gdb cannot attach to my application. I tried executing "target exec /path/to/my.nexe", but nothing changed.
Am I missing something here? Is there any other way to debug applications loaded as unpacked extensions with nacl-gdb?
My OS is Ubuntu 12.04 and I am using pepper_27 of nacl_sdk. Chrome version is 27.0.1453.93.
Thanks
I assume you were using this guide, which I was using earlier as well. It is out of date. These are the real instructions. It seems that the way you attach the debugger has completely changed, and it is no longer possible to use --nacl-gdb (that is planned for removal). You must manually attach the debugger by following these steps.
The full guide is here, but I'll summarize:
Launch Chrome with chrome --enable-nacl --enable-nacl-debug --no-sandbox --disable-hang-monitor.
Run <NACL_SDK_ROOT>/toolchain/win_x86_newlib/bin/x86_64-nacl-gdb (with no arguments).
Enter these commands into the gdb prompt:
(gdb) nacl-manifest <path-to-your-.nmf-file>
(gdb) nacl-irt <CHROME-DIR>/nacl_irt_x86_64.nexe
(gdb) target remote localhost:4014
Now you can use gdb as normal. (If you just want to run the application until it crashes, start by typing continue.)

Google Chrome 21 is not supporting --disable-web-security command line switch

Since the latest release of Google Chrome browser version 21.* and Selenium Chrome Driver version 22.* , the special command line switch “--disable-web-security” which we have been using to test our iframes with different domain is no longer supported (deprecated).Is there any workaround for the same to automate our frame which is in different domain in Chrome browser?
Our existing functional Automation framework completely depends on this switch (--disable-web-security).Response would be appreciated.
You don't need a workaround, the flag still works, what's new is the warning.
I just performed a test using jQuery to send an AJAX request to another domain and it worked using the command-line flag, and it didn't when not using it.
It would be nice to have a way to disable the "yellow infobar", though.
(I'm running Chrome 21.0.1180.60).
You might also have to kill all running instances of the Chrome.exe running in the background before using the flag.
Yes. What turned out to be the issue is even after you close chrome... there is a chrome.exe process running. Kill it using taskmanager and the flag will work even in version 28