VB脚本集声明

时间:2013-06-28 15:57:20

标签: vbscript error-handling set

我需要以下代码的帮助:

Dim IE 
Dim UserName

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://www.nextview.com/index.php?country=my"
Do Until IE.ReadyState <> 3
Loop

Set UserName = IE.Document.getElementById("username")     <----- ERROR
IE.Document.all.UserName.Value = "TESTING"
Set Login = IE.Document.getElementById("frmlogin")
Login.submit
Do Until IE.ReadyState <> 3
Loop

创建代码是为了帮助我输入用户名。但它在上面显示的位置有错误。

知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

我认为您的等待Do..Loop不正确。

'Syntax notes:
Do Until [expression return False]
Do While [expression return True]

'So, you can use one of the next:
Do Until IE.readyState = 4
    Wscript.Sleep 100
Loop

Do While IE.readyState <> 4
    Wscript.Sleep 100
Loop
相关问题