如何在VBA中进行Web报废时在<b>标签内获取数据

我正试图从这个网站上取消数据。 我写了打开这个网站的代码,然后search一个值。 点击search结果并打开最后一页,我必须从中select详细信息。 我需要select在红色提到的标签的细节

这个图片

这是我的代码,打开所需的页面。 我已经使用Link.click打开所需的页面。 之后,我需要获取图片中提到的细节。 好心提醒。

Sub hullByAshish() Dim html, html1 As HTMLDocument Dim ElementCol, ElementCol1 As Object Dim Link As Object Dim appIE As Object Dim a As String Dim i As Long Dim objElement As Object Dim objCollection As Object Set appIE = CreateObject("internetexplorer.application") a = "PONTOVREMON" With appIE .Navigate "https://www.marinetraffic.com/en/ais/index/search/all/keyword:" & a .Visible = True End With Do While appIE.Busy DoEvents Loop Application.Wait (Now() + TimeValue("00:00:01")) Set html = appIE.document Set ElementCol = html.getElementsByTagName("a") DoEvents For Each Link In ElementCol If Link.innerHTML = "PONTOVREMON" Then Link.Click End If Next Link End Sub 

这是一种方法

 Dim ie As Object, ieDoc As Object, lnk As Object Sub hullByAshish() Dim IMO As String, MMSI As String, GTon As String Set ie = CreateObject("internetexplorer.application") a = "PONTOVREMON" With ie .Navigate "https://www.marinetraffic.com/en/ais/index/search/all/keyword:" & a .Visible = True End With Do While ie.readystate <> 4: Wait 5: Loop DoEvents Set ieDoc = ie.document For Each lnk In ieDoc.getElementsByTagName("a") If lnk.innerhtml = "PONTOVREMON" Then lnk.Click Exit For End If Next lnk Do While ie.readystate <> 4: Wait 5: Loop IMO = GetValue("IMO:") MMSI = GetValue("MMSI:") GTon = GetValue("Gross Tonnage:") Debug.Print "IMO: " & IMO Debug.Print "MMSI: " & MMSI Debug.Print "Gross Tonnage: " & GTon End Sub Function GetValue(s As String) As String GetValue = Trim(Split(Split(Split(Trim(Split(ie.document.body.innerhtml, s)(1)))(0), "<b>")(1), "</b>")(0)) End Function Private Sub Wait(ByVal nSec As Long) nSec = nSec + Timer While nSec > Timer DoEvents Wend End Sub 

截图

在这里输入图像说明