试图运行spec.js时,量角器错误105

时间:2016-05-03 09:14:05

标签: protractor

我的量角器工作正常,更新后它无法打开一个简单的spec文件,它总是会给出错误。我搜索了一个解决方案,但无法找到一个conf和spec文件是量角器网站本身的样本我粘贴错误,希望你可以帮助。提前致谢

conf.js错误

[09:10:06] E/configParser - error code: 105
[09:10:06] E/configParser - description: failed loading configuration file spec.js

C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130

throw new exitCodes_1.ConfigError(logger, 'failed loading configurat
ion file ' + filename);
            ^
Error
    at ConfigError.ProtractorError (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\exitCodes.js:10:22)
    at new ConfigError (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\exitCodes.js:26:16)
    at ConfigParser.addFileConfig (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130:19)
    at Object.initFn [as init] (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\launcher.js:94:22)
    at Object.<anonymous> (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\cli.js:130:10)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)

conf和spec文件是来自网站的示例文件

conf.js:

exports.config = {
  framework: 'jasmine',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['spec.js']
}

spec.js

describe('Protractor Demo App', function() {
  it('should have a title', function() {
    browser.get('http://juliemr.github.io/protractor-demo/');

    expect(browser.getTitle()).toEqual('Super Calculator');
  });
});

10 个答案:

答案 0 :(得分:10)

Per @jtzero的评论,问题在于配置解析器在加载配置文件时屏蔽了实际的错误消息。

根据您是将Protractor作为全局还是从文件夹运行,请在第13行打开(C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\configParser.js。 在那里你可以添加logger.error(e);例如:

    /**
     * Public function specialized towards merging in a file's config
     *
     * @public
     * @param {String} filename
     */
    ConfigParser.prototype.addFileConfig = function (filename) {
        if (!filename) {
            return this;
        }
        var filePath = path.resolve(process.cwd(), filename);
        var fileConfig;
        try {
            fileConfig = require(filePath).config;
        }
        catch (e) {
            logger.error(e);
            throw new exitCodes_1.ConfigError(logger, 'failed loading configuration file ' + filename);
        }
        if (!fileConfig) {
            throw new exitCodes_1.ConfigError(logger, 'configuration file ' + filename + ' did not export a config object');
        }
        fileConfig.configDir = path.dirname(filePath);
        this.addConfig_(fileConfig, fileConfig.configDir);
        return this;
    };

然后,这将报告输出中的错误。就我而言,这是对require()的失败调用:

[10:36:29] E/configParser - { [Error: Cannot find module 'phantomjs'] code: 'MODULE_NOT_FOUND' }

已回复的GitHub问题#3301:https://github.com/angular/protractor/issues/3301

<强>更新
Protractor 4.0将包含针对此问题的修复程序,以使用堆栈跟踪报告屏蔽的错误消息。

答案 1 :(得分:3)

您应该运行conf.js文件,而不是spec.js文件。

当它应该是“protractor conf.js”时,看起来你正在运行命令“protractor spec.js”。该错误表明它正在寻找配置文件,但您传递的是spec文件。

答案 2 :(得分:1)

将正确的路径传递给conf.js文件可以是一种解决方案。尝试导航到您拥有此文件的文件夹,然后再次启动该命令。

当然,请指向conf.js文件,而不是spec。

答案 3 :(得分:0)

我通过重新安装不知道问题是什么或者是什么来修复它

答案 4 :(得分:0)

我遇到了同样的问题(带有另一个错误代码),并修复了将Java路径添加到环境变量的问题(SDK安装程序没有自动配置它)。

答案 5 :(得分:0)

我收到此错误是因为.messages的内容无效。
我错误地使用了conf.js而不是seleniumAddress= "http://localhost:4444/wd/hub"(使用相等的seleniumAddress: "http://localhost:4444/wd/hub"而不是冒号=)。

  

(错误105-conf.js问题)

更改:后,一切正常,

conf.js

答案 6 :(得分:0)

我也遇到了同样的问题。但这可能是因为我们尚未将文件保存在Visual Studio中,无论我们编写了什么代码,都必须保存文件。我已保存它,然后运行它,对我来说效果很好。对我来说,这就是解决方案。无论我们编写了什么代码,都必须在运行之前保存它。

答案 7 :(得分:0)

使用

应该可以
Elastic Beanstalk

但是,请确保已更新或启动了webdriver-manager,否则可能会拒绝驱动程序连接。

答案 8 :(得分:0)

您需要输入正确的路径,然后在其中运行conf.js protractor conf.js

答案 9 :(得分:0)

我遇到的相同问题,如下所述用于解决。

exports.config = { directConnect:是的, seleniumAddress:'http:// localhost:4444 / wd / hub', 规格:['spec.js'] };

相关问题