Internet explorer 使用vbscript打开IE对象时出现问题

Internet explorer 使用vbscript打开IE对象时出现问题,internet-explorer,object,vbscript,sleep,Internet Explorer,Object,Vbscript,Sleep,我正在用VBscript填充表单。现在,如果用户未登录,我将等待他登录,然后填充表单。这是密码 While ie.document.getElementById("age") Is Nothing Wend 想法是直到脚本能够找到它将在循环中运行的年龄元素。一旦他成功登录,他将被重定向到表单,脚本可以在其中找到年龄元素并退出循环。然后下面的代码填充表单 IE.Document.All.Item("sample").Value = "sample" 现在,问题是。。由

我正在用VBscript填充表单。现在,如果用户未登录,我将等待他登录,然后填充表单。这是密码

    While ie.document.getElementById("age") Is Nothing

    Wend
想法是直到脚本能够找到它将在循环中运行的年龄元素。一旦他成功登录,他将被重定向到表单,脚本可以在其中找到年龄元素并退出循环。然后下面的代码填充表单

    IE.Document.All.Item("sample").Value = "sample"
现在,问题是。。由于while循环,当用户尝试输入用户名和密码时,输入会出现延迟。。他必须慢慢地一个字母一个字母地打字,否则就会被跳过。我怎样才能解决这个问题


谢谢。

根据我的理解,我会这样做的。如果你想要一个更好的答案,你应该发布你的全部代码

Sub busy
do while ie.busy
wscript.sleep 200
loop
End Sub

On Error Resume Next
Call busy
Do until ie.document.getElementById("age") = "age"
wscript.sleep 200
loop
Call busy
ie.Document.All.Item("sample").value = "sample"
你试过在循环中使用吗?