David Grinberg David Grinberg - 5 months ago 14
Javascript Question

How to launch tests in Chrome with the console docked at the bottom, not the right?

Whenever I launch Karma on Chrome a new Chrome window pops up. When I bring up the console on this Chrome Window the console comes up attached to the right side. I prefer the console attached to the bottom so I always bring it down - its kind of annoying.

How can I get Karma to launch Chrome with the console docked at the bottom?


It seems that there is no straightforward way to do that.

Although you could specify custom launcher options for Chromium, there is no option that controls devtool position. (Though there is --auto-open-devtools-for-tabs that can also be handy in your case.)

However, there's a nice hack described in a related issue:

A brute force approach is to pass the --user-data-dir flag to a custom launcher:

browsers: ['Chrome'],
customLaunchers: {
  Chrome_DevTools_Saved_Prefs: {
    base: 'Chrome',
    flags: ['--user-data-dir=./tests/config/.chrome_dev_user']


karma start --browsers Chrome_DevTools_Saved_Prefs

This will allow you to reuse the profile. When you want to test using a fresh profile, use the default Chrome launcher or wipe the user-data-dir.

UPDATE: as @KFunk points out, this case is covered in Karma's documentation in a bit nicer way:

customLaunchers: {
  Chrome_with_debugging: {
    base: 'Chrome',
    chromeDataDir: path.resolve(__dirname, '.chrome')