Open Chrome from terminal with developer console o

2019-04-18 17:58发布

问题:

I can run Google Chrome from the command line using $ google-chrome, but what flag can I pass to open it with developer console already open, preferably open to the console tab?

I checked the man page for google-chrome but it states that

Google Chrome has hundreds of undocumented command-line flags that are added and removed at the whim of the developers.

I'm hoping one of those undocumented flags does what I want.

回答1:

The flag you're looking for is --auto-open-devtools-for-tabs. Please note, that you should quit Chrome before this setting will take effect.

This has worked at least since Chrome 55.0.2883.87 m (the latest version as of initial post)



回答2:

A Google employee maintains this list of automatically updated Chromium flags. There doesn't seem to be a flag for opening Chrome with developer console open.



回答3:

What exactly are you trying to achieve by that? If you are trying to run some kind of automated tests, you should try out PhantomJS.



回答4:

Seems there is no such option. I added a feature request in Chrome product forum https://productforums.google.com/forum/#!category-topic/chrome/give-feature-feedback-and-suggestions/mac/Stable/3HYIAl8_ndc