I have a auto submit or Click
(button) code, i want to add time delay for 2 seconds in this code?
Code Here :
document.evaluate("//input[@value='Submit Now' and @type='submit' and contains(@class, 'button')]", document, null, 9,
null).singleNodeValue.click();
Please Help, Thank you!
This looks like a javascript issue, you tagged is as 'java' and 'script'.
To delay this in javascript, you can pass it into the setTimeout function like so:
setTimeout(function() {
document.evaluate("//input[@value='Submit Now' and @type='submit' and contains(@class, 'button')]", document, null, 9, null).singleNodeValue.click();
}, 2000);
That should do it.
If you need delay after document.evaluate, assign before setTimeout:
var element = document.evaluate("//input[@value='Submit Now' and @type='submit' and contains(@class, 'button')]", document, null, 9, null);
setTimeout(function () {
element.singleNodeValue.click();
}, 2000);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.