user1833875
user1833875

Reputation: 99

Testacular doesn't launch chrome browser

When I run testacular with 'browsers' set to "Firefox", a new firefox browser opens. I can open the console in there and see my 'console.log' messages etc...

When I run testacular with 'browsers' set to "Chrome" or "ChromeCanary", no new browser opens. The tests run correctly, but I can't see the console (because I've got no browser).

I have CHROME_PATH set in my windows settings (and CHROME_CANARY_PATH too), I get no error messages regarding browser startup and as I say, my tests work correctly.

Any ideas why my browser doesn't open??

Answered by Vojta : There is a bug on Chrome windows: http://code.google.com/p/chromium/issues/detail?id=151836 Chrome is running, but it does not show the UI.

Upvotes: 4

Views: 2167

Answers (1)

John Hatton
John Hatton

Reputation: 1784

It could be that the fix Vojta pointed to above (setting the window to maximize) solved your problem, but it didn't solve it for me now, 4 months later.

My first advice is to find out exactly what the launcher is using to try and start Chrome:

karma start <yourconfig> --log-level debug

On my system, I found two problems with Karma(Testacular) version 0.8.4, either of which was enough to keep Chrome from opening on my Windows 7 64 with Chrome 26:

1) Getting the command line shorter & pointed at Chrome

First, there's something about the launcher command which, in the context of it being called, should work but doesn't. It works if I paste it in to a console myself, but not when Karma runs it. Perhaps it's just a bit too long.

To fix this

  1. Put Chrome onto your Windows PATH environment variable.
  2. Set the CHROME_BIN Windows Environment variable to just "chrome.exe".

Now the command line will start with just chrome.exe, rather than the full path to it. Note, this also solves another problem (pointed to by Joe below), that the default path for Chrome that Karama uses points somewhere in your user directory, not in your Program Files. So by setting this Environment variable, you cause Karma to use it instead.

2) Fixing the user-data-dir

Next, through try-and-error, I found that the launcher command uses an equals sign after one of its parameters, which also makes Chrome not start correctly. I can't explain why. But the fix is easy:

  1. Find the chrome.js file and change

'--user-data-dir=' + this._tempDir,

to

'--user-data-dir ' + this._tempDir,

If this helps other people, let me know, I'll submit a pull request. But at the moment, I'm in that "no one else is mentioning this, so maybe it's just something weird about my system" mode...

Upvotes: 3

Related Questions