我正在尝试测试,如果我的应用程序在使用下面的mocha.js和webdriver.io代码操作后正确地重定向了客户机。
it("Should redirect to correct URL.", function() {
assert.equal(
$("window").getAttribute("location"),
`http://localhost:8080/${path}`,
);
});然而,我得到了错误:
不能使用选择器“窗口”对元素调用getAttribute,因为找不到元素
窗口对象似乎在webdriver的选择器函数范围之外,但我看不到任何其他方式访问文档中的当前URL。
发布于 2019-07-19 05:22:23
使用v4函数找到getUrl文档。
it("Should redirect to correct URL.", function() {
assert.equal(
browser.getUrl(),
`http://localhost:8080/${path}`,
);
});https://stackoverflow.com/questions/57105850
复制相似问题