我试图使用jQuery选择与我Nightwatch.js端对端测试 根据这样的回答:Nightwatch.js e2e测试如何在全局范围内设置jQuery?
How to write a nightwatch custom command using jquery
我需要有jQuery的在我的应用程序的这种全球范围内的工作提供。 (否则我与$(选择)裁判麻烦......
'use strict';
var ClickElementByIndex = function(className, index) {
if (!index) {
index = 0;
}
this.execute(function(selector, i) {
var $item = $(selector + ':eq(' + i + ')');
if (!!$item) {
$item.click();
return true;
}
return false;
}, [className, index], function(result) {
console.info(result);
});
};
exports.command = ClickElementByIndex;
重复的问题请参阅答案。在https://stackoverflow.com/questions/21674080/how-to-use-npm-jquery-module – erwin