【发布时间】:2020-06-11 11:38:48
【问题描述】:
我的页面对象是结构化的,因此我拥有一个对象中的所有元素,然后是一个对象数组,其中包含有关可以循环测试最大字符长度和错误文本的字段的数据。
我希望定位器引用数组外部的属性,以便在元素更改时不需要更新值两次。
以页面对象的片段为例...
module.exports = {
siteName: element(by.id('P662_NAME')),
fields: [
{
name: 'site name',
max: 45,
locator: element(by.id('P662_NAME'))
}
]
}
我尝试过使用以下方法,但没有成功...
this.siteName, this.siteName, module.exports.siteName
有没有办法做到这一点?
【问题讨论】:
-
绝对有必要在字段对象本身之外使用定位器吗?
标签: javascript node.js json testing protractor