I would like to receive the following data for each player:
- Purchase price (this value does not exist for each player!),
- lowest price,
- maximum price.
With my current coding I get as innertext all 3 values. But these are not separated! How can I evaluate these values individually?
If the purchase price does not exist, the placeholder "not found" should be output. How can I do this without an individual id or classname?
HTML structure is as follows:
<div class="historyPrice">
<div>
<strong>6,2 Mio</strong>
<span>Gekauft</span>
</div>
<div>
<strong>0,5 Mio</strong>
<span>Tiefstwert</span>
</div>
<div>
<strong>9,4 Mio</strong>
<span>Höchstwert</span>
</div>
</div>
It´s the same structure without "purchase Price" (in german "gekauft"). But the first "div" is missing.
<div class="historyPrice">
<div>
<strong>0,5 Mio</strong>
<span>Tiefstwert</span>
</div>
<div>
<strong>9,4 Mio</strong>
<span>Höchstwert</span>
</div>
</div>
My coding is as follows:
Sub PlayerValues()
Dim ie As New SHDocVw.InternetExplorer
Dim HTMLdoc As MSHTML.HTMLDocument
Dim HTMLPlayerValues As MSHTML.IHTMLElementCollection
Dim HTMLPlayerValue As Object
Dim URL1 As String
Dim currentRow As Long
URL1 = ws.Cells(currentRow, 11).Value
ie.Visible = False
ie.Navigate URL1
lastRow = ws.Cells(Rows.Count, 10).End(xlUp).Row
For currentRow = 7 To lastRow
Do While ie.ReadyState <> READYSTATE_COMPLETE
Loop
Application.Wait (Now + TimeValue("0:00:3"))
Set HTMLdoc = ie.Document
Set HTMLPlayerValues = HTMLdoc.getElementsByClassName("historyPrice")
For Each HTMLPlayerValue In HTMLPlayerValues
Debug.Print HTMLPlayerValue.innerText
Debug.Print "----------"
Next HTMLPlayerValue
Next currentRow
ie.Quit
End Sub