等待Button加载Vbscript

时间:2016-01-30 10:26:17

标签: vbscript

这是我的代码:

'What do i put here to wait until V that down there exists before continuing?

ie.Document.getElementById(":zv.gt").Click

'Do While ie.Busy Or ie.ReadyState <> 4: WScript.Sleep 5000: Loop <---- Wont work because the button doesnt actually popup until after the Page is already finished loading.

我怎样才能让它在继续之前不断检查按钮是否存在?

1 个答案:

答案 0 :(得分:0)

这似乎已经成功了。 Thx无论如何StackOverflow。

 'Waits for button to load and clicks the button once loaded
    '----------------------------------------------------------------------
    Do  
        On Error Resume Next
        set x = ie.Document.getElementById(":zv.Ss")
        If x is nothing then
           wscript.sleep 200
        else    
            ie.Document.getElementById(":zv.Ss").click
        Exit Do
        end if
        On Error Goto 0   
    Loop