简体   繁体   English

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

[英]Protractor : browser.get() doesn't function

I am a newbie using protractor for angularjs app e2e testing. 我是使用protractor进行angularjs应用e2e测试的新手。 I have the latest version of protractor setup and using Visual studio 2015 as the IDE. 我拥有最新版本的量角器安装程序,并使用Visual Studio 2015作为IDE。

The function browser.get() mentioned in my tests doesn't work and only opens up a browser window with "Data:,". 我的测试中提到的功能browser.get()不起作用,仅打开带有“ Data :,”的浏览器窗口。

Here is my config.js file : 这是我的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();
    }
};

Here is my spec.js file : 这是我的spec.js文件:

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

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

Am i missing out on anything? 我错过了什么吗? Please help! 请帮忙! i have been trying to fix this since 3 days now. 自3天以来,我一直在尝试解决此问题。

The first thing, 第一件事,

chromeDriver: './node_modules/protractor/selenium/chromedriver.exe'

is not needed.Your web-driver manager manage it. 不需要。您的网络驱动程序管理员可以对其进行管理。

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

UPDATE : 更新:

Please fire following command : 请执行以下命令:

webdriver-manager update

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM