Problem: If Need a javascript function to wait for a certain time until the next command execution
Solution:(JavaScript function)
function sleep(milliseconds) {
var date = Date.now();
var currentDate = null;
do { currentDate = Date.now(); }
while (currentDate – date < milliseconds);
}