【发布时间】:2016-04-27 20:43:17
【问题描述】:
我有以下用 javascript 为 nightwatch.js 编写的自定义命令。如何将其翻译为使用 jquery?
exports.command = function (classId, indexIfNotZero) {
this.browser.execute(function (classId, indexIfNotZero) {
if (classId.charAt(0) == '.') {
classId = classId.substring(1);
}
var items = document.getElementsByClassName(classId);
if (items.length) {
var item = indexIfNotZero ? items[indexIfNotZero] : items[0];
if (item) {
item.click();
return true;
}
}
return false;
//alert(rxp);
}, [classId, indexIfNotZero], function (result) {
console.info(result);
});
};
【问题讨论】:
标签: javascript jquery nightwatch.js