Testacular不会启动Chrome浏览器 [英] Testacular doesn't launch chrome browser

查看:182
本文介绍了Testacular不会启动Chrome浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将'浏览器'设置为Firefox的时候运行testacular时,会打开一个新的Firefox浏览器。我可以在那里打开控制台,看到我的'console.log'消息等等。



当我将'browsers'设置为Chrome或 ChromeCanary,没有新的浏览器打开。这些测试运行正常,但我看不到控制台(因为我没有浏览器)。

我在Windows设置中设置了CHROME_PATH(还有CHROME_CANARY_PATH ),我没有收到有关浏览器启动的错误消息,正如我所说的,我的测试正常工作。



任何想法为什么我的浏览器不能打开?



由Vojta回答:Chrome窗口存在一个错误: http://code.google.com/p/chromium/issues/detail?id=151836
Chrome正在运行,但它没有显示UI。

解决方案

这可能是上面指出的修复Vojta(设置窗口最大化)解决了您的问题,但它现在还没有为我解决,4个月后。



我的第一个建议是准确找出启动程序用来尝试启动Chrome的原因:

  karma start< yourconfig> --log-level debug 

在我的系统中,我发现了两个与Karma(Testacular)版本0.8有关的问题.4,其中任何一个都足以让Chrome在我的Windows 7 64上通过Chrome 26无法打开:

1)让命令行更短&指向Chrome



首先,有一些关于launcher命令的内容,它在调用的上下文中应该可以工作,但不会。如果我自己将它粘贴到控制台上,但它在Karma运行时不起作用。也许它只是有点太长。



解决此问题


  1. 将Chrome放到Windows PATH环境变量中。



  2. $ b 现在,命令中的CHROME_BIN Windows环境变量设置为chrome.exe行将从chrome.exe开始,而不是完整的路径。请注意,这也解决了另一个问题(由Joe指出),Karama使用的默认路径指向用户目录中的某处,而不是在Program Files中。所以通过设置这个环境变量,你可以让Karma使用它。



    2)修复user-data-dir
    $ b $接下来,通过尝试错误,我发现启动器命令在其参数之后使用了一个等号,这也使得Chrome无法正确启动。我无法解释为什么。但修复很简单:


    1. 找到chrome.js文件并更改

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



    to



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



    如果这有助于其他人,请告诉我,我会提交一个拉请求。但目前,我的意思是没有其他人提到这一点,所以也许这只是我的系统奇怪的一种模式...。


    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.

    解决方案

    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...

    这篇关于Testacular不会启动Chrome浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆