Protractor.js:加载页面时出错

时间:2017-06-15 06:09:30

标签: javascript angularjs protractor e2e-testing

我是protractor.js的新手。 我有一个场景,我正在获取要测试的页面,在该页面中,我找到了一个要点击的元素,然后重定向到其他页面。

config.js

exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',

capabilities: {
    'browserName': 'chrome'
},
rootElement: '.apt.ui',

specs: ['./protractor-tests/homeTest.js'],

jasmineNodeOpts: {
    showColors: true
}

};

主页测试页:

这些是我为实现场景而编写的测试用例。

describe('Home Test', function() {
it('It should click product', function() {
    var targetUrl = 'http://domain/home';
    browser.get(targetUrl);

})
it('looking for the product', function() {
    browser.waitForAngular();
    var productMenu = element(By.xpath('/html/body/div[1]/headerdiv[1]/section/div[1]/apt-nav-bar/div/div[2]/div[2]/ul/li[2]/a/span'));
    productMenu.isPresent();
    productMenu.click();
    expect(browser.getCurrentUrl()).not.toEqual('http://domain/home');
    expect(browser.getCurrentUrl()).toEqual('http://domain/products');
})

});

但是当我运行这个时,我收到错误:

 Message:
Failed: Error while waiting for Protractor to sync with the page: "Cannot read property '$$testability' of undefined"

我不明白这一点。 任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

这是Protractor的一个问题,已经提到here。请仔细阅读该问题。此问题已在<div className="search-results-item" // pass the event here onClick={event => this.fill_name(event, this.props.name)} /> 中修复。请更新您的量角器,如果您仍然能够重现这一点,请向量角器小组提交一个问题。

相关问题