【问题标题】:Protractor: open window and test url量角器:打开窗口和测试 url
【发布时间】:2014-04-15 19:42:34
【问题描述】:

我正在尝试测试打开新窗口的表格中的链接。我要测试新窗口的url。

到目前为止,我所拥有的是:

    it('Should verify new window url', function () {
    page.list.get(0).click().then(function () {
        browser.getAllWindowHandles().then(function (handles) {
            newWindowHandle = handles[1];
            browser.switchTo().window(newWindowHandle).then(function () {
                expect(browser.getCurrentUrl()).toMatch(/\/url/);
            });
        });
    });
});

错误:等待 Protractor 与页面同步时出错:{}

如果我删除期望就可以工作....我对承诺感到困惑,有人可以指导我正确的方向吗?

【问题讨论】:

    标签: protractor angularjs-e2e


    【解决方案1】:

    原来新页面上没有角度,因此我不得不使用底层驱动程序。

    expect(browser.driver.getCurrentUrl()).toMatch(/\/url/);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-16
      相关资源
      最近更新 更多