--load-extension parameter for chrome doesn't work (mac) - google-chrome

This is the command to load a single extension
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --load-extension="~/Library/Application\ Support/Google/Chrome/Default/Extensions/cflchafndefoljnhhholeekfpgmbphaf/1.51_0/"
It throws me “Failed to load extension from: . Manifest file is missing or unreadable.”.
The weird thing is if I copy the extension to /tmp/ and load from there. It works.

Related

Chrome Headless print-to-pdf using PDF file input

I'm trying to use Headless Chrome to re-print a pdf file from a pdf file.
Similar Post: Print PDF with headless chrome in ubuntu
I've tried several variations of this:
chrome --headless --disable-gpu --print-to-pdf=E:/Python/Working/foo_flat3.pdf file://E:/Python/Working/foo_flat2.pdf
chrome --headless --disable-gpu --print-to-pdf=E:/Python/Working/foo_flat3.pdf "E:/Python/Working/foo_flat2.pdf"
And no PDF file is generated. When I use a webpage, for example:
chrome --headless --disable-gpu --print-to-pdf=E:/Python/Working/foo_flat3.pdf https://www.google.com/
It functions as intended, and "foo_flat3.pdf" is generated.
Why am I doing this? I'm trying to make use of Chrome's ability to unlock and flatten pdf files, as it is the fastest option I've found. If there's other options, I would be interested in those too.

Chrome's --auto-open-devtools-for-tabs

I'm trying to get the devtools to open automatically when starting chrome from a shortcut with a command line switch --auto-open-devtools-for-tabs.
i.e. the path of that shortcut is: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -incognito -auto-open-devtools-for-tabs (or --auto-open-devtools-for-tabs).
But both don't seem to open the dev tools, neither does entering in the cmd chrome.exe -auto-open-devtools-for-tabs (or --auto-open-devtools-for-tabs), of course when in Chrome's folder.
Maybe I'm doing something wrong?
The command is from:
http://peter.sh/experiments/chromium-command-line-switches/#auto-open-devtools-for-tabs
https://stackoverflow.com/a/41452619/4279201
This flag only applies when you open the first chrome instance.
Close all chrome windows
Run "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -incognito -auto-open-devtools-for-tabs
If you want your daily browser, with all tabs but without devtools, at the same time as you're debugging a website with devtools automatically opening, you have to run them separately.
Alternative: Stable + Beta
One example is to use example Chrome stable and Chrome beta.
"C:\Program Files\Google\Chrome\Application\chrome.exe"
"C:\Program Files\Google\Chrome Beta\Application\chrome.exe" --auto-open-devtools-for-tabs
Alternative: data-dir
"C:\Program Files\Google\Chrome\Application\chrome.exe" -incognito --auto-open-devtools-for-tabs --user-data-dir="%APPDATA%\ChromeDevOrAnyName"

How to load-and-launch a Google Chrome App from the command line?

At this link, it says:
These command line options to Chrome may help you iterate:
--load-and-launch-app=/path/to/app/ installs the unpacked application from the given path, and launches it.
What is the entire command line statement?
For example, is it:
$ chrome --load-and-launch-app=/path/to/app/
or maybe:
$ cca --load-and-launch-app=/path/to/app/
What, specifically, is the entire command?
The basic command you have correct
/Path/to/Chrome --load-and-launch-app=/Path/to/App
Assuming you are using Mac, OSX(from your comments) and you installed Google Chrome the normal way, (into your Applications directory), your /Path/to/Chrome will be
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
But to make sure you can your Google Chrome Application directly into your terminal (assuming standard MacOSX terminal or iTerm)
For the /Path/To/App part of the command, use the directory which contains the manifest.json file.
For instance, if your path to the manifest.json file is
/Users/[Your Username]/Downloads/basic/manifest.json
which you can get from going to this link
Your command to load and launch the "Basic" google chrome app is
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --load-and-launch-app=/Users/[Your Username]/Downloads/basic
One additional detail that may be helpful: the path to your app must be an absolute path, beginning at the root directory (/).
You have to do --load-and-launch-app=/Users/YourUsername/Documents/my_chrome_app
Alternately, if you don't want to type the whole path, you could use $PWD, which evaluates to your current directory (must execute the command from the same directory as your manifest.json):
--load-and-launch-app=$PWD
You cannot do --load-and-launch-app=.
You cannot do --load-and-launch-app=~/Documents/my_chrome_app

Edit chrome command line args

When I type in chrome://version there's a box that looks like this:
Command Line: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --extensions-on-chrome-urls --test-type --load-extension="c:\Program Files\Google\Chrome\Application\Extensions\chrome\app\37.1329.15.30" --load-component-extension="c:\Program Files\Google\Chrome\Application\Extensions\chrome\man" --flag-switches-begin --flag-switches-end
It seems to be loading an unwanted extension, and I always have to go uninstall "Max Adblock" from the extension devtools app. Can I edit the builtin command line args to stop it from loading this extension?

Chrome won't allow local camera access

I'm trying to test out some code for accessing a webcam on an HTML page and Chrome doesn't seem to allow me to. I made an exception for the file and yet everytime I reload (which it tells me will put the settings in effect) it goes back to blocking it
Go to:
chrome://flags/#unsafely-treat-insecure-origin-as-secure
Add your url there and enable this flag, relaunch and it should work.
You can open chrome with the flag disable-web-security
For Mac, in terminal:
open -a /Applications/Google\ Chrome.app/ --args --disable-web-security
For a PC in console:
chrome.exe --disable-web-security