量角器:browser.get()不起作用

时间:2016-02-11 10:23:21

标签: javascript angularjs protractor protractor-net

我是使用量角器进行angularjs app e2e测试的新手。 我有最新版本的量角器设置,并使用Visual Studio 2015作为IDE。

我的测试中提到的函数browser.get()不起作用,只打开一个带有" Data:,"的浏览器窗口。

这是我的config.js文件:

'use strict';
exports.config = {
        directConnect: true,
        chromeDriver: './node_modules/protractor/selenium/chromedriver.exe',

    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        'browserName': 'chrome'

    },

    // Spec patterns are relative to the current working directly when
    // protractor is called.
    specs: ['example_spec.js'],
    framework: 'jasmine',

    // Options to be passed to Jasmine-node.
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000
    },

    onPrepare: function () {
        browser.driver.manage().window().maximize();
    }
};

这是我的spec.js文件:

describe('angularjs homepage', function () {
    it('should have a title', function () {
      browser.get('http://angularjs.org/');

        expect(browser.getTitle()).toContain('AngularJS');
    });
});

我错过了什么吗?请帮忙!我从3天开始就试图解决这个问题。

1 个答案:

答案 0 :(得分:0)

首先,

chromeDriver: './node_modules/protractor/selenium/chromedriver.exe'
不需要

。您的网络驱动程序管理员会对其进行管理。

If your protractor version is >3.0  then install node > 4.0.

更新:

请点击以下命令:

webdriver-manager update