量角器.js:加载页面时出错



我是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"

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

这是量角器的一个问题,这里已经提到过。请通读问题。此问题已在 Protractor 5.1.2 中修复。请更新您的量角器,如果您仍然能够重现此内容,请向量角器团队提交问题。

相关内容

最新更新