Starting Chrome on macOS from the Finder with extra command line parameters - macos

I want to stuff remote debugging and other esoteric dev-only only parameters to the Chrome application when it starts but I want it to be always there, including when I click on the app icon.
E.g.:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
How do I pass these command line parameters to the app directly?

I ended up creating an automator application with as shell task. Customized the icon and replaced Chrome.app with the new app in the dock.
I am still looking for a way to change the settings in Chrome so it can connect with remote debugger "on-demand" for specific tasks (not everything as it is set now) but that doesn't seem to be possible at this time. The VSCode folks have apparently solicited the Chrome team to provide this functionality. Stay tuned...

Related

Using Chrome command line args --window-workspace not working

I'm trying to configure puppeteer to launch Chrome on a specific screen (or workspace) on macOS. I've found the --window-workspace CLI argument but it doesn't work. I tried every number from 0 to 10 (the number of workspaces I have on 3 screens), and the Chrome window shows up in the same workspace.
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --window-workspace=3
Is there a different way of identifying the workspace?
This is especially useful when working with multiple monitors and debugging puppeteer with headless mode turned off, having the ability to designate a screen where the window shows up would better the developer UX.

Launch Firefox from Finder with logging modules

I have found this site: https://developer.mozilla.org/en-US/docs/Mozilla/Debugging/HTTP_logging
My problem is: The settings for about:networking only work for the current session. And I have no interest to always start Firefox from the console. Is there a way to launch Firefox (under Mac OS X) via Finder and to permanently enable those logging features?
BG
I'm not a Mac user, so this might be not the best way. However, you might try using an approach similar to running Firefox with multiple profiles, as documented here on MDN. It suggests creating an Automator application that runs a shell script. You can follow this guide, which tells you to:
Open Automator
Go to File->New->Application
Choose Utilities group under Library
Drag Run Shell Script to the workflow pane on the right
Paste the script used to run Firefox with logging enabled
Choose Save As and store it somewhere
You should be good to go.

Javascript console not working if Google Chrome is started from OS X terminal

Since I am working locally with d3.js, I need to launch Google Chrome with the --allow-file-access-from-files option. To do this, I start Chrome from the OS X terminal, as follows:
open /Applications/Google\ Chrome.app --args --allow-file-access-from-files
However, it seems that this prevents the javascript console from working correctly. console.log() does not print anything anymore. I suppose the output is redirected elsewhere when Chrome is started this way.
Is there a way to launch Chrome with options and still have the console working as usual?
I've got the same problem. The solution for me was to uncheck the "Set locale environment variables on startup" checkbox in the terminal settings.
After that, restart the terminal and google chrome.
https://groups.google.com/forum/#!topic/google-chrome-developer-tools/rC9_0sIejvs

Show Firefox OS devtools on Firefox Developer Edition 'desktop'

I've an iMac with OS X Yosemite v.10.10.3. I use Firefox Developer Edition 40.0a2. I've a ZTE Open C (FR version) with Firefox OS; Boot2Gecko 2.1.0.0-prerelease (B2G OS).
What I'd like to do is the following: I've a basic webpage (mostyl HTML, CSS and JS) opened in my browser on my Firefox OS phone. I'd like to get the devtools (Cmd+Shift+i) and be able to edit that webpage with my Firefox Developer Edition browser on my iMac.
I've already tried these things:
Use webIDE.
Follow this potential solution.
Connecting a Firefox OS device.
WebIDE Troubleshooting.
Comment déboguer facilement du web y compris sur tablettes et téléphones—french article.
With webIDE, I can build a new app for Firefox OS (with or without a base theme) and I can use the devtools to inspect the DOM and stuff like that. I just want to achieve the exact same thing but directly on my desktop computer.
Do you have any clue?
Feel free to ask me if you need more piece of informations. ;)
Current status
When I launch the Firefox OS browser app, I can inspect (via the devtools) the homepage (DOM stuff, etc.). But when I load another webpage (Google for example), I can't inspect the DOM. Any idea about that?
I often get this message: http://puu.sh/ir2Ju/32563e51bc.png when I switch to several apps I want to debug.
If I understand correctly, you're trying to connect the Firefox Developer Edition WebIDE on your desktop to a tab that is open on your Firefox OS phone. Something like this?
If that's right, once you connect to your phone in the WebIDE, you should see a list of open browser tabs at the bottom of the "Open App" menu, which is in the top left of the WebIDE panel.
When you connect your phone, you have to accept remote debugging.
Then on the left of the window, you should see a dropdown menu with the apps that you can debug. By default, you can only debug unprivileged applications.
Click on the app, the you want to debug and in the middle of the screen click on the "wrench". It is the button to activate debugging.
Now the complicated part. In order to debug privileged apps such as the web Browser. You have to root your phone and change some preferences. To check that you have a rooted phone. Click on the runtime menu and then runtime info.
If your adb is in root mode, then you can press the button to request higher privileges. You can also do that by hand.
There for more info:
https://developer.mozilla.org/fr/docs/Tools/WebIDE/Running_and_debugging_apps#Unrestricted_app_debugging_%28including_certified_apps.2C_main_process.2C_etc.%29
https://developer.mozilla.org/en-US/Firefox_OS/Using_the_App_Manager#Using_the_B2G_desktop_client
Using a real device
On your computer, enter the following command in Terminal/console to enter your device's filesystem via the shell:
adb shell
Your prompt should change to root#android. Next, stop B2G running using the following command:
stop b2g
Navigate to the following directory:
cd /data/b2g/mozilla/*.default/
Here, update the prefs.js file with the following line:
echo 'user_pref("devtools.debugger.forbid-certified-apps", false);' >> prefs.js
After you've finished editing and saving the file, start B2G again using the following command:
start b2g
Exit the android filesystem using the exit command; this will return you to your normal terminal prompt.
Next, reconnect to the App Manager and you should see certified apps appear for debugging.
When this is done, you should see the application "Browser" in the list of available apps for debugging. At the same time, you should see all other application of your phone available as debugging.

Silent install for Safari extension on Mac without any user prompting

I am setting up Selenium testing for Safari 5 on Mac. I need to install our Safari extension before hand, and it needs to happen silently and without any user prompting. From previous posts, I've found this works in that it loads the browser with the extension:
open -a Safari okta.safariextz
But it leaves the browser opened with a prompt to the user: "Are you sure you want to install the extension?"
Selenium doesn't have access to this prompt and can't click install. I need to configure Safari such that it does not prompt the user to install, but just allows the extension to be installed.
Is there any way to do this?
Any pointers appreciated.
-Denali
Edit: Possible new method: The answer here might suggest (it's somewhat unclear) that, with a possible risk of messing up your future safari upgrades, you might be able to manually install an extension, skipping the confirmation prompt, via a file move and a plist hack. I haven't tried it, but it looks as if it might work:
If you're just doing this for in-house deployment and don't mind if it breaks on a Safari upgrade, then you can quit Safari, install the extension into ~/Library/Safari/Extensions and update ~/Library/Safari/Extensions/Extensions.plist (the format is rather obvious; /usr/libexec/PlistBuddy is useful for such things).
You can't do what you're after--at least, not with any commandline switch or plist hack that I know of. Extension install confirmation is a core part of Safari's security model, and is not easily circumvented.
Instead, I'd consider using automator (if you're not familiar with it, think Selenium but for desktop apps, and more) to send a click on the appropriate button, and then distributing an automator app that launches safari with the appropriate parameters, sends the click when the extension dialog appears, and then goes on to run Selenium-based (rather than automator-based) automations. To get started, I'd check out the following links:
Automating via applescript rather than the "duplo legos" automation builder: http://www.mactech.com/articles/mactech/Vol.21/21.06/UserInterfaceScripting/index.html
Very brief overview of macro recording (you hit record, send the click you want, hit save, and you can re-execute your recorded actions): http://automator.us/leopard/features/virtual-user.html
My favorite intro to automator tutorial: http://cjrtools.org/mac/tutorials/autohowto.html
I don't believe there is any way to do a silent extension install as it would be a security hole. You may want to try incorporating an AppleScript to do the extension install before running your Selenium tests.
Here is another question on StackOverflow with AppleScript details for Safari extension reloading that can be used for your purposes:
How to reload a Safari Extension from the command line?

Resources