【发布时间】:2018-01-04 10:37:36
【问题描述】:
我一直在使用页面对象模式和 WebdriverIO 并尝试声明将在子页面中继承的选择器。这两个我都试过了
function Page() {
this.loader = function() {
return $("div[class*='loading'] svg");
}
}
还有这个
Page.prototype.loader = function() {
return $("div[class*='loading'] svg");
}
当我从子页面调用这个函数时,例如
checkoutPage.loader.waitForVisible(5000, true);
我收到“checkoutPage.loader.waitForVisible”不是函数”错误。如何为基本页面声明 getter 以便可以从任何子页面调用?
【问题讨论】:
-
不应该是
checkoutPage.loader().waitForVisible()吗?
标签: javascript node.js automated-tests pageobjects webdriver-io