【问题标题】:Protractor error using PhantomJS使用 PhantomJS 的量角器错误
【发布时间】:2015-04-02 07:53:27
【问题描述】:

我正在使用 phantomJS 和量角器在我的角度页面上运行 e2e 测试,由 gulp(标准角度生成器)生成。当我想运行第二个命令时,我会收到以下错误:“在等待量角器与页面同步时出错:“[ng:test] no injector found for element argument to getTestability...”

  • phantomjs --webdriver=5000
  • gulp 量角器

我已经在互联网上查找了它,也在 stackoverflow 上查找过,但没有找到解决方案。大家都说是因为protractor找不到angular页面,所以我必须在protractor.conf.js中调整rootelement-option。我试过了,但对我来说没有用……有人有解决这个问题的方法吗?

这是我的 protractor.conf.js

exports.config = {
seleniumAddress: 'http://localhost:5000',
rootElement: 'html',

capabilities: {
    browserName: 'phantomjs',
    'phantomjs.binary.path': 'C:/Users/..../proj_Jesper2/node_modules/phantomjs/bin/phantomjs',       
},

specs: [paths.e2e + '/**/*.js'],

framework: 'jasmine',
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
    onComplete: function () {
    },
    isVerbose: true,
    showColors: true,
    includeStackTrace: true,
    defaultTimeoutInterval: 30000
}
};

这是 index.html 角度页面:

<!doctype html><html ng-app="testJesper2"><head><meta charset="utf-8"><title>testJesper2</title><meta name="description" content=""><meta name="viewport" content="width=device-width"><link rel="stylesheet" href="styles/vendor-79b86c72.css"><link rel="stylesheet" href="styles/app-56ebb463.css"></head><body><!--[if lt IE 10]>


<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
 <![endif]--><div ui-view=""></div><script>
      (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
      function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
      e=o.createElement(i);r=o.getElementsByTagName(i)[0];
      e.src='//www.google-analytics.com/analytics.js';
      r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
      ga('create','UA-XXXXX-X');ga('send','pageview');
    </script><script src="scripts/vendor-8ebd933c.js"></script><script src="scripts/app-a7333f52.js"></script></body></html>

【问题讨论】:

  • 我还收到另一个错误:UnknownError: Missing Command Parameter - {"headers":{"Accept":"application/json; charset=utf-8","Connection":"close" ,"Content-Length":"25","Content-Type":"application/json;charset=UTF-8","Host":"localhost:5000"},"httpVersion":"1.1","method ":"POST","post":"{\"args\":[],\"script\":null}","url":"/execute","urlParsed":{"anchor":" ","查询":"","文件":"执行","目录":"/","路径":"/执行","相对":"/执行","端口":"", "host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/execute" ,"queryKey":{},...
  • 你能解决这个额外的错误吗?以及如何?

标签: javascript angularjs phantomjs protractor ghostdriver


【解决方案1】:

问题解决了。当我使用 gulp 时,我忘了运行一个命令,这搞砸了整个项目……“gulp serve”是关键!

【讨论】:

    猜你喜欢
    • 2015-05-07
    • 2014-08-17
    • 1970-01-01
    • 2014-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-07
    相关资源
    最近更新 更多