|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub usdratio()
Dim objBrowser As New clsBrowser
objBrowser.start "edge", cleanActiveSession:=True
'By default, the new window is minimized, use .show to bring it out
objBrowser.show
objBrowser.navigate "https://www.safe.gov.cn/safe/gzhbdmyzslb/index.html"
objBrowser.wait till:="interactive" 'only need to wait until page is interactable. Refer to definition for other options
'objBrowser.jsEval ("document.getElementsByTagName(""a"")[" & 10 & "].click()")
For i = 20 To objBrowser.jsEval("document.getElementsByTagName(""a"").length") - 1
jscode = objBrowser.jsEval("document.getElementsByTagName(""a"")[" & i & "].outerHTML")
If InStr(jscode, "各种货币对美元折算率") And InStr(jscode, "年") Then
objBrowser.jsEval ("document.getElementsByTagName(""a"")[" & i & "].click()")
objBrowser.navigate "https://www.safe.gov.cn" & Split(Split(jscode, """")(1), """")(0)
objBrowser.wait till:="interactive" 'only need to wait until page is interactable. Refer to definition for other options
Exit For
End If
Next
For i = 0 To objBrowser.jsEval("document.getElementsByTagName(""a"").length") - 1
jscode = objBrowser.jsEval("document.getElementsByTagName(""a"")[" & i & "].outerHTML")
If InStr(jscode, "各种货币对美元折算率") And InStr(jscode, "年") Then
objBrowser.jsEval ("document.getElementsByTagName(""a"")[" & i & "].click()")
objBrowser.navigate "https://www.safe.gov.cn" & Split(Split(jscode, """")(1), """")(0)
objBrowser.wait till:="interactive" 'only need to wait until page is interactable. Refer to definition for other options
Exit For
End If
Next
End Sub |
|