Trying to Execute multiple line js scripts in 1 call, but the function of ExecuteScript right after the first and not waiting till the end of the full code.
using a js sync waiting function to demonstrate it, I have a js function syncwait(ms), which halts js for a given time.
Here is example code
retval= driver.ExecuteScript("syncwait(3000); alert('after first wait'); syncwait(3000); alert('after 2nd wait');")
messagebox(retval)
My message box will show right after the first syncwait() is completed, and 3 seconds later I'll get the 2nd alert, is there anyway to make the ExecuteScript wait for full execution?
this is my syncwait code
function syncwait(ms) {
var start = Date.now(),
now = start;
while (now - start < ms) {
now = Date.now();
}
}
Trying to Execute multiple line js scripts in 1 call, but the function of ExecuteScript right after the first and not waiting till the end of the full code.
using a js sync waiting function to demonstrate it, I have a js function syncwait(ms), which halts js for a given time.
Here is example code
My message box will show right after the first syncwait() is completed, and 3 seconds later I'll get the 2nd alert, is there anyway to make the ExecuteScript wait for full execution?
this is my syncwait code