2
有了这个代码,我想检索值从网站的特定标签,并把它放在我的电子表格中从Internet Explorer类的值:提取使用Visual Basic
Sub get_tit()
Dim wb As Object
Dim doc As Object
Dim sURL As String
Dim lastrow As Long
lastrow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
Set wb = CreateObject("internetExplorer.Application")
wb.navigate "https://www.tyre-shopper.co.uk/search/205-55-16/V/91"
Do While wb.Busy
Loop
Set doc = wb.document
Price = SelectNodes("#more-tyres > li:nth-child(4) > div > div.result-buy > form > span.tyre-price > div.tyre-price-cost.tyres-1 > strong")
Range("A5").Value = Price
End Sub
我试图用CSS路径将其选为节点,但不能。 我也试图从类中选择,但再没有奏效
这是从网站的代码,从中我想检索值57.50
<span class="tyre-price">
Fully Fitted Price
<div class="tyre-price-cost tyres-1">
<strong>£57.50</strong>
</div><div class="tyre-price-cost tyres-2" style="display:none">
<strong>£115.00</strong>
</div><div class="tyre-price-cost tyres-3" style="display:none">
<strong>£172.50</strong>
</div><div class="tyre-price-cost tyres-4" style="display:none">
<strong>£230.00</strong>
</div><div class="tyre-price-cost tyres-5" style="display:none">
<strong>£287.50</strong>
</div>
</span>