vendredi 31 juillet 2020

Getting span id innertext

Friends, I am trying to get the value of innerText but not able to do it. Please suggest, thanks.

Set dados = oHtml.getElementsByClassName("Label1")(0).getElementsByTagName("span")

i = 0
For Each oElement In dados
    Sheets("Data").Range("A" & i + 1) = dados(i).innerText
    i = i + 1
Next oElement
aaa:
Resume Next
On Error GoTo bbb
Set dados = oHtml.getElementsByClassName("detail-val")(0).getElementsByTagName("td")
i = 0
For Each oElement In dados
    Sheets("Data").Range("A" & i + 1) = dados(i).innerText
    i = i + 1
Next oElement
bbb:
Resume Next

HTML Code:

<table id="TdPrice" width="350px" cellpadding="0" cellspacing="0" border="0" style="text-align: left; font-size: 12px; line-height: 15px; float: right">
<tr><td colspan="2" class="detail-mtit"></td></tr>
<tr><td class="detail-tit" style="width:150px;">Price USD:</td>
<td width="160px" class="detail-val">4.00</td>
</tr>
<tr><td class="detail-tit">QTY In Stock:</td>
<td class="detail-val"><span id="Label1">5</span></td>
</tr>



Aucun commentaire:

Enregistrer un commentaire