Dim TheURL As New Uri("URL string")
AxWebBrowser1.Navigate(TheURL)
AxWebBrowser1.Navigate(TheURL)
釋放元件
AxWebBrowser1.Dispose()
以元件名字取得所開啟網頁內的元件
Imports mshtml
Dim e1 As Object = AxWebBrowser1.Document
Dim ebay As Object = e1.all
Dim ebay As Object = e1.all
ebay.item("元件name").value
ebay.item("元件name").click()
…etc
解析HTML
Dim TheLength As Integer = ebay.length
Dim i As Integer
For i = 0 To TheLength – 1
If LCase(ebay.item(i).tagname) = "td" Then
If ebay.item(i).innertext = "Buyer Email" Then
….
End If
End If
Dim i As Integer
For i = 0 To TheLength – 1
If LCase(ebay.item(i).tagname) = "td" Then
If ebay.item(i).innertext = "Buyer Email" Then
….
End If
End If
If LCase(ebay.item(i).tagname) = "b" Then
Select Case ebay.item(i).uniqueID ‘每一個TAG都有一個uniqueID, 以TAG的位置順序安排
Case "ms__id76"
TheEmailAddress = ebay.item(i).innertext
Case "ms__id80"
TheItemName = ebay.item(i).innertext
End Select
End If
Next
Select Case ebay.item(i).uniqueID ‘每一個TAG都有一個uniqueID, 以TAG的位置順序安排
Case "ms__id76"
TheEmailAddress = ebay.item(i).innertext
Case "ms__id80"
TheItemName = ebay.item(i).innertext
End Select
End If
Next
判斷元件是否存在
IsNothing(ebay.item("元件name"))
元件陣列, 當網頁中有數個同名的元件時
ebay.item("元件name", 0).click() ‘第一個
ebay.item("元件name", 1).click() ‘第二個
沒有留言:
張貼留言