【问题标题】:Browser switch handle Phantomjs Issue浏览器切换句柄 Phantomjs 问题
【发布时间】:2015-06-16 14:49:43
【问题描述】:

我将量角器与黄瓜一起使用,每当需要在带有 phantomjs 的浏览器选项卡之间切换时,它就会挂起而没有任何错误消息。然而,同样的步骤适用于 Chrome 浏览器。这是为什么?我的步骤如下

this.Then(/^the page url hash should be "([^"]*)"$/, function (arg1, callback) {
    browser.getAllWindowHandles().then(function (handles) {
        newWindowHandle = handles[2];
        browser.switchTo().window(newWindowHandle).then(function () {
            expect(browser.driver.getCurrentUrl()).to.eventually.contain(arg1).and.notify(callback);
        });
    });

【问题讨论】:

标签: selenium testing phantomjs protractor cucumberjs


【解决方案1】:

好吧,显然问题出在callback。当我稍微修改上面的代码时,即使在 phantomjs 中它也像一个魅力!

this.Then(/^the page url hash should be "([^"]*)"$/, function (arg1, callback) {
       browser.getAllWindowHandles().then(function (handles) {
            newWindowHandle = handles[2];
            browser.switchTo().window(newWindowHandle).then(function () {
                expect(browser.getCurrentUrl()).to.eventually.contain(arg1);
            });
        });
        callback();

  });

【讨论】:

    猜你喜欢
    • 2018-04-20
    • 2015-03-16
    • 1970-01-01
    • 2023-04-05
    • 2021-05-20
    • 1970-01-01
    • 2011-10-31
    • 2016-09-18
    • 1970-01-01
    相关资源
    最近更新 更多