1) used the following strategy to iterate over DOM elements using Nightwatch:
// Executing a function in the application context. client.execute(function () { // Get elements by CSS selector. var elements = document.querySelectorAll('.elements'); // Iterate over them. [].forEach.call(elements, function (element) { // Manipulate each element. element.click(); }); });
2) the number returned by allitems.value[0].ELEMENT
will work as the id.
3) jQuery 定位
$('#padt_lic_numb > ul > li > label').each(function(){ $(this).click(); });
4) nightwatchjs
client.elements("css selector","#padt_lic_numb > ul > li > label",function(results)
{
results.value.forEach(function(index){
// console.log('Element value is '+index.ELEMENT);
client.elementIdText(index.ELEMENT,function(result){
//console.log(result.value);
if(result.value == plate_number)
{
console.log(result.value);
console.log(plate_number);
client.elementIdClick(index.ELEMENT);
}
});
})
});