我正在尝试从网页获取信息。我需要的信息在一个表格中,我没有直接解决它。这是页面: http ://www.idealo.de/preisvergleich/MainSearchProductCategory.html?q=matratze
表ID是:plist我需要的每一行都有名称“js4offer”,而不是我需要表行中的第二个和第三个“tr”,但我不知道如何循环遍历这一行中的所有元素桌子。我尝试了数千个代码片段,但没有一个在做我想做的事;)
到目前为止,这是我的代码:
Sub website()
Set sht = Sheets("Tabelle4")
rCount = 1
Set objIE = CreateObject("InternetExplorer.application")
With objIE
.Visible = True
.Navigate "http://www.idealo.de/preisvergleich/MainSearchProductCategory.html?q=Matratze"
Do While .Busy Or .ReadyState <> 4
DoEvents
Loop
Set objHTML = objIE.Document
readText = objHTML.body.outerHTML
Cells(1, 1) = readText
Set myElements = objHTML.getElementById("plist")
For Each ele In myElements
If ele.getElementsByName("js4offer") Then
rCount = rCount + 1
Cells("A", rCount) = ele.Item(1)
Cells("B", rCount) = ele.Item(2)
End If
Next ele
End With
objIE.Quit
Set objIE = Nothing
End Sub