【发布时间】:2016-01-25 23:35:17
【问题描述】:
我无法使用 css 或中继器获取所有元素。
this.clickRandomEmployee = function(){
employees = elementController.getAllElements('css','#employee-list li');
numberOfEmployees = employees.length;
console.log(numberOfEmployees);
var numRand = this.getRandomNumber(numberOfEmployees);
console.log(numRand);
elementController.doubleClick(employees.get(numRand));
}
this.getAllElements = function(locatorType,value){
var emps;
console.log(locatorType);
console.log(value);
if(locatorType=='css'){
emps = element.all(by.css(value));
}
else if(locatorType=='repeater'){
emps = element.all(by.repeater(value));
}
return emps;
};
上面的代码是从测试脚本中调用来查找所有元素的,但它返回未定义。请推荐!!
【问题讨论】:
标签: javascript selenium protractor