ExecuteScript wait for full JS to execute
IsaacBreuer opened this issue · 2 comments
IsaacBreuer commented
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();
}
}
wolflash666 commented
这是来自QQ邮箱的假期自动回复邮件。
已经收到,等我看到了,立马回复。
iisboy commented
欢迎交流SeleniumBasic ,QQ群:点击链接加入群聊【天天ASP家园】:https://jq.qq.com/?_wv=1027&k=mBY9APOM