5

I know that I can open Chrome with the devtools dock placed to the right using the flag:

--auto-open-devtools-for-tabs

What I would like is to be able to modify the placement of the dock from the command line.

Is there any flag or configuration that would allow me to place the dock on startup wherever I want?

Or, can it be done using the Chrome Devtools Protocol?

guzmonne
  • 2,490
  • 1
  • 16
  • 22

1 Answers1

2

I've figured out how to do this for my Ruby on Rails app, which uses RSpec, Capybara, and Selenium WebDriver. Here's the code I use to set up my Capybara driver and place the dock at the bottom. I also configured the "Console" tab to be selected by default.

options = Selenium::WebDriver::Chrome::Options.new
options.add_preference(
  'devtools',
  'preferences' => {
    'currentDockState' => '"bottom"', # Or '"undocked"'
    'panel-selectedTab' => '"console"',
  }
)

...

Capybara::Selenium::Driver.new(
  app,
  browser: :chrome,
  options: options,
  desired_capabilities: capabilities,

I figured out how to set these preferences by looking at ~/Library/Application Support/Google/Chrome/Default/Preferences. This is where my main Google Chrome installation stores my user preferences.

You can view all of the possible settings under devtools => preferences. Note that all the values are strings that are parsed as JSON, so you need to "double-wrap" any strings in your code: '"bottom"'.

ndbroadbent
  • 13,513
  • 3
  • 56
  • 85