如何用VB获取网页中各输入框的id
如何用VB获取网页中各输入框的id,请各位高手帮忙。
[解决办法]
这是利用webbrowser控件向填写网页并提交源码的一段楼主参考一下:
Sub mDemoWB_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim vDoc, vTag
Dim i As Integer
Set vDoc = mDemoWB.Document
For i = 0 To vDoc.all.Length - 1
If UCase(vDoc.all(i).TAGNAME) = "INPUT " Then
Set vTag = vDoc.all(i)
Debug.Print vTag.Value & " " & vTag.Type
If vTag.Type = "text " Or vTag.Type = "password " Then
Select Case vTag.Name
Case "hobby "
vTag.Value = "2007-01-01 "
Case "hobby1 "
vTag.Value = "2007-01-31 "
End Select
ElseIf vTag.Type = "submit " Then
vTag.Click
End If
End If
Next i
End Sub