用VB添加個webbrowser控鍵進來盡量把它在窗體上畫大點 我把webbrowser的name屬性改為IE,當然也可以是你自己喜歡 |
- Private Sub Form_Load()
- '初始化時打開該網頁
- IE.Navigate "s4.travian.cn/login.php" '自己加http://並不是宣傳, 測試用途
- End Sub
- Private Sub command1_Click()
- Dim vDoc, vTag
- Dim i As Integer
- Set vDoc = IE.Document
- For i = 0 To vDoc.All.length - 1 '檢測所有標籤
- If UCase(vDoc.All(i).tagName) = "INPUT" Then '找到input標籤
- Set vTag = vDoc.All(i)
- If vTag.Type = "text" Then 'TYPE
- vTag.Value = "123456" '這個是輸入到用戶名中得值
- End If
- If vTag.Type = "password" Then 'TYPE
- vTag.Value = "123456" '這個是輸入到密碼框中的值
- End If
- If vTag.Name = "s1" Then
- vTag.Click
- End If
- End If
- Next i
- End Sub
- Private Sub command2_Click()
- Dim vDoc, vTag
- Dim i As Integer
- Set vDoc = IE.Document
- For i = 0 To vDoc.All.length - 1 '檢測所有標籤
- If UCase(vDoc.All(i).tagName) = "INPUT" Then '找到input標籤
- Set vTag = vDoc.All(i)
- If vTag.Name = "s1" Then
- vTag.Click '點擊確定鍵
- End If
- End If
- Next i
- End Sub
沒有留言:
張貼留言