VB 网页自动登陆
Option Explicit
Private Sub Command1_Click()
WebBrowser1.Navigate "http://mc.qeedoo.com/servers.php"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim vDoc, vTag
Dim i As Integer
Set vDoc = WebBrowser1.Document
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT" Then
Set vTag = vDoc.All(i)
If vTag.Type = "text" Or vTag.Type = "password" Then
Select Case vTag.Name
Case "userid" '帐号
vTag.Value = "XXXXXXX"
Case "pwd" '密码
vTag.Value = "PPPPPPP"
End Select
ElseIf vTag.Type = "button" Then
vTag.Click
End If
End If
Next i
End Sub
高人看看啊,能输入帐号和密码就是不按登陆
另外在请教flash的怎样做自动登陆啊,比如这个网站http://s.qeedoo.com/mc/s28/
[最优解释]
也就是改为:
Case "pwd" '密码
vTag.Value = "PPPPPPP"
End Select
End If
End If
Next i
Dim OButton
OButton = WebBrowser1.Document.getElementsByTagName("BUTTON")
OButton.Click
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
WebBrowser1.Document.getElementsByName("userid")(0)
.Value = "XXXXXXX"
WebBrowser1.Document.getElementsByName("pwd")(0)
.Value = "PPPPPPP"
WebBrowser1.Document.getElementsByTagName("button")(0).click
End Sub
Option Explicit
Private Sub Command1_Click()
WebBrowser1.Navigate "http://mc.qeedoo.com/servers.php"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
WebBrowser1.Document.getElementsByName("userid")(0).Value = "XXXXXXX"
WebBrowser1.Document.getElementsByName("pwd")(0).Value = "PPPPPPP"
WebBrowser1.Document.getElementsByTagName("button")(0).click
End Sub