I'm trying to print pdf from Gmail with headless chrome in command line.
I cannot install pupeteer or another tool with the computer that script will run on, due to unability to install anything.
For simple gsuite pages such as https://myaccount.google.com/, my script runs perfectly.
For more complex ones such as gmail, the output PDF I get shows a partially loaded page:
output PDF
I'm already using the --run-all-compositor-stages-before-draw option which should wait for the page to resolve before printing.
I've tried to add --virtual-time-budget=10000 just before --run-all-compositor-stages-before-draw, however if I ask for more than 2000 milliseconds the command runs for ever without producing the output pdf.
See my code so far below (which I put in a .bat file)
Does anyone have encountered that issue ? Any lead on how to solve it ? Any ways to first load the page, then have a timeout command, then print to pdf ?
I couldn't find a solution so far on the web.
Thanks :)
Ps: english isn't my primary language, please excuse any mistake
#set outputFile=C:\Users\MyUserName\Temp\testPDFprintChromeheadless\test.pdf
#set chromeDirectory=C:\Program Files (x86)\Google\Chrome\Application
#set url=https://mail.google.com/mail/
#set userData=C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data
#set profile=MyChromeProfile
#set useragentChrome="Mozilla/5.0 (X11\\; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36"
#cd "%chromeDirectory%"
chrome.exe --headless --disable-gpu --profile-directory="%profile%" --user-data-dir="%userData%" --user-agent=%useragentChrome% --run-all-compositor-stages-before-draw --print-to-pdf="%outputFile%" --print-to-pdf-no-header "%url%"
pause
Edit :
Here are the logs I get.
AccÞs refusÚ means Accès refusé which is french for Access denied.
I don't have administrator rights on this computer, thus not able to write within the Chrome directory, that could explain this access denied.
[0820/101506.995:ERROR:cache_util_win.cc(20)] Unable to move the cache: AccÞs refusÚ. (0x5)
[0820/101506.996:ERROR:cache_util.cc(144)] Unable to move cache folder C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default\GPUCache to C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default\old_GPUCache_000
[0820/101506.997:ERROR:disk_cache.cc(184)] Unable to create cache
[0820/101506.997:ERROR:shader_disk_cache.cc(606)] Shader Cache Creation failed: -2
[0820/101509.033:ERROR:cache_util_win.cc(20)] Unable to move the cache: AccÞs refusÚ. (0x5)
[0820/101509.034:ERROR:cache_util.cc(144)] Unable to move cache folder C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default\Cache to C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default\old_Cache_000
[0820/101509.035:ERROR:disk_cache.cc(184)] Unable to create cache
[0820/101510.020:ERROR:service_worker_storage.cc(1899)] Failed to delete the database: Database IO error
[0820/101513.168:INFO:CONSOLE(1763)] "Deprecated API for given entry type.", source: https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.fr.YnGL5qwRpj4.O/am=rvxfykdgoP_swM-GUSAcAAM5SAABYIUsYuW09wdKmv8BAwAGoG_F8GAQrnkAdJzCuAQAAAAAAAAAAAAAAAAAAADsAisGAQ/d=1/exm=b/ed=1/im=1/dg=0/br=1/wt=1/rs=AHGWq9AzRZEBJ1Ek7NOabODYvaA7PPmCUQ/cb=loaded_1/m=a (1763)
[0820/101519.465:INFO:headless_shell.cc(648)] Written to file C:\Users\MyUserName\Temp\testPDFprintChromeheadless\test.pdf.
Related
I'm running a Chrome Extension on a Windows 10 computer but sometimes it crashes and it's always when I'm not in front of the computer. I'd like to find a way to see what happened and find out the reason of the crash.
I have started chrome in debug mode with this:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ---enable-logging --v=1 ---vmmodule ---no-sandbox
I can't find a chrome_debug.log anywhere.
I see a couple of DMP files in the Chrome folder. I have tried to edit them with Windbg but the information I get out of it is very limited:
*** WARNING: Unable to verify checksum for chrome_child.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for chrome_child.dll -
rax=00000000aae79636 rbx=000266be30311920 rcx=000002d27ba72f40
rdx=000002d27ba76380 rsi=000000000000b880 rdi=0000000002b801d0
rip=00007ff802feaf07 rsp=000000f125dfdde0 rbp=000000f125dfde00
r8=0000000000000000 r9=0000000000000140 r10=000002d200005c00
r11=0000000000000000 r12=0000000000000003 r13=00007ff8074875a9
r14=000002d27ddb0820 r15=0000518316a04000
iopl=0 nv up ei pl nz na po nc
cs=0033 ss=0000 ds=0000 es=0000 fs=0053 gs=002b efl=00010206
chrome_child!ChromeMain+0x419517:
00007ff8`02feaf07 3b03 cmp eax,dword ptr [rbx] ds:000266be`30311920=????????
That doesnt help me much unfortunately. My browser console crashed with the extension so I can't see there what happened. If I could may be have active logging on the console, that could help but I don't know how to do this.
The extension sometimes run fine for a couple of days and then suddenly it crashes, I don't really see a pattern here.
I have taken the "massage" option from wOxxOm here below and I get more information but again, it's not something that helps me very much as I don't see something related to the chrome extension:
Any idea?
Thanks!
I've been searching for a while now and I can't find the exact list of all fail to load error code/error description of google chrome.
I'm talking about this the highlighted text
Can someone give me a link?
I did some digging and I must admit, it's not easy to find a full exhaustive list of all (Chromium) networking error codes.
The full list of all Chromium error codes can be found in the file net_error_list.h:
https://cs.chromium.org/chromium/src/net/base/net_error_list.h
It looks like Google Chrome prepends ERR_ to all the codes listed in the above list.
However, error codes in XHR error responses are slightly different. These codes follow the format of the linux system file errno.h as defined by POSIX.1-2001, or C99:
http://man7.org/linux/man-pages/man3/errno.3.html
Finally, some common NodeJS errors have been listed at the NodeJS API Documentation:
https://nodejs.org/api/errors.html#errors_common_system_errors
I'd like to end this answer with a simple comparison example. The error of an operation timeout would be named as follows by the listed 'standards':
TIMED_OUT internally in Chromium.
ERR_TIMED_OUT displayed in Google Chrome.
ETIMEDOUT in the XHR error object (error.code).
Using your example:
CONNECTION_REFUSED -> internally in Chromium
ERR_CONNECTION_REFUSED -> displayed in Google Chrome
ECONNREFUSED -> in linux (POSIX.1) or network error stacks
By the way for only listing all error codes
USE :
chrome://network-errors/
It's about 220 in total as of now in chrome version (69.0.3497.100)
I have chromium Version 97.0.4692.71 (Official Build), snap (32 bit), on Description: Ubuntu 18.04.6 LTS. The problem was solved using the command in the terminal
chromium --no-sandbox
after that everything worked.
I'm doing automated tests with Chrome.
Part of my suite needs flash to be activated (sight...).
I'm struggling to activate it. Here's what I got:
If I open a regular chrome session, with Flash checked in chrome://plugins, it works there:
When the tests start, the command line executed is:
▶ ps -edf | grep chrome
augustin 24752 24743 2 12:12 pts/0 00:00:07 /opt/google/chrome/chrome --user-data-dir=/tmp/karma-22735678 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling http://test.example.com:8080/?id=22735678
I always get Download failed or sometimes flash version outdated.
Even if I check flash in plugins and reload, even if I allow it specifically for this tab and refresh:
I tried several command line options:
--always-authorize-plugins from there
--enable-plugins from there
without sucess. :(
Thanks for the help
EDIT:
If I click on + details in chrome://plugins, I can see that in a regular session, Location is set to /home/augustin/.config/google-chrome/PepperFlash/23.0.0.207/libpepflashplayer.so
, while, in the command-lined open I get: Location: internal-not-yet-present
This might be the explanation, though I still don't know how to fix it.
I made it by copying the content of /home/augustin/.config/google-chrome/PepperFlash/* into /opt/google/chrome/PepperFlash, chmod -r +rx /opt/google/chrome/PepperFlash and then adding the following flags to the launcher :
customLaunchers: {
Chrome_plugins: {
base: 'Chrome',
flags: ['--ppapi-flash-path=/opt/google/chrome/PepperFlash/23.0.0.207/libpepflashplayer.so', '--enable-plugins', '--always-authorize-plugins']
}
},
Not very plug&play, neither compatible with other laptops, but at least works.
A more robust solution would be welcome!
I tried setting up devstack in a desktop that i have and I am running into few problems.
I created an instance but when I try to access it in the console I get "unauthorized access" exception. In the previous version of devstack I was able to access the console in the UI.
This URL below seems to be having some issues:
http://192.168.0.10:6080/vnc_auto.html?token=d2da2ca250bb&title=u1(9f58-8f58ed778d3b)
I saw that the most recent version of devstack has the following vnc related change:
https://review.openstack.org/#/c/140860/
https://review.openstack.org/#/c/107073/
However, I am not sure if I should revert this change or is there a different way to enable the vnc?
When I grep for all the ports that are open and listening 6080 is not one of them.
I see following in my nova.conf
vncserver_proxyclient_address = 127.0.0.1
vncserver_listen = 127.0.0.1
vnc_enabled = true
xvpvncproxy_base_url = http://192.168.0.10:6081/console
novncproxy_base_url = http://192.168.0.10:6080/vnc_auto.html
You need to enable the service in local.conf file by adding the line enable_service n-novnc. And then run a fresh stack.sh which will download and start the novnc service.
My Windows Store app keeps getting rejected from certification testing and I managed to reproduce a consequent crash when running appverif's LuaPriv-check. I get this output though:
AVRF: failed to create verifier log file \??\C:\Users\xx\AppVerifierLogs\yy.exe.0.dat (status C0000022)
Process Monitor tells me yy.exe got ACCESS DENIED on a CreateFile operation in this folder. I have set full access to all users (the user reported in the log was the same as the owner of the folder). I am running Visual Studio and Application Verifier as Administrator, but this does not seem to apply. What is the correct way of giving user xx full access to this folder on win8? I have attempted to use different log folders for appverify but with no success. Anyone else able to use this tool with Store-apps?
This post describes similar issues. Attempting to run AppVerif –sppath C:\MyLogsLocation as in the suggested workaround gives AVRF: Error: Incorrect image name: <
So does running appverif -enable handles locks -for myapp.exe -sppath c:\MyLogsLocation
It might be a bug in app verifier.
Have a look at these links:
http://social.technet.microsoft.com/Forums/en-US/5ed560c0-76af-401d-8150-8cd1e69d0b8a/why-app-verifier-can-not-create-log-file?forum=windowssdk
http://blogs.msdn.com/b/dougste/archive/2010/01/11/generating-application-verifier-logs-for-web-applications.aspx
0xc000022 is STATUS_ACCESS_DENIED. The process doesn't actually have write permissions, even if it looks like it should. This MSDN blog explains there is a bug in App Verifier so even if you specify -sppath the value won't be honoured unless you first delete the %WINDIR%\system32\config\AppVerifierLogs\ folder.