I would like to do following instructions:
1. Fill input with id "ivoucher".
2. Click button with class "voucher-add-check".
3. Wait 5 seconds
And i would like to have it in for loop. I have following code, but it not working:
(function() {
'use strict';
for (var i = 1; i <= 3; i++) {
(function(a) {
jQuery('#ivoucher').val(i);
$('button[class*="voucher-add-check"]').click();
setTimeout(function() {
console.log(document.getElementById('ivouchermessage'));
}, i * 5000);
})(i);
}
})();
iis defined in the loop. Inside yourIIFEyou should usea(parameter of the function).