【发布时间】:2017-12-28 18:53:04
【问题描述】:
我正在开发一个从不同国家海关网站抓取进口税的网络机器人,我在从以下网站检索我想要的值时遇到问题:http://www.aduanet.gob.pe/itarancel/arancelS01Alias,使用 CODIGO 旁边的测试值 3303000000。我要检索的值是“Ad / Valorem”旁边的 6%,但它所在的表没有 ID 属性或类或与直接获取或至少接近它相关的东西。我一直在尝试使用 .parent 和 .child 方法,但没有成功。到目前为止我的代码如下:
Function Peru(partida As String) As String
'Open IE
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.navigate "http://www.aduanet.gob.pe/itarancel/arancelS01Alias"
'Load sub
Cargar
'Navigate further into the website (Im using partida = 3303000000)
For Each box In objIE.document.getElementsByTagName("input")
If box.Name = "cod_partida" Then
box.Value = partida
Exit For
End If
Next
For Each boton In objIE.document.getElementsByTagName("input")
If boton.Value = "Consultar" Then
boton.Click
Exit For
End If
Next
'Get the 6% value (This part is the one I cant figure out)
End Function
【问题讨论】:
-
要达到你所追求的内容,你必须用两个
iframes来跨越。
标签: excel vba internet-explorer