標題: [發問] How to scrape this website dynamic data from Javascript with VBA? [打印本頁] 作者: DanielWONG 時間: 2022-11-19 16:43 標題: How to scrape this website dynamic data from Javascript with VBA?
Sub test2()
Set chrome = CreateObject("selenium.chromedriver")
chrome.get "https://www.hangseng.com/en-hk/personal/insurance-mpf/e-mpf/fund-price-performance/"
chrome.Wait 1000
Set A_s = chrome.FindElementsBytag("a")
For i = 1100 To A_s.Count
If A_s(i).Text = "Acknowledge" Then A_s(i).Click: Exit For
Next
ReDim ar(1 To 1000, 1 To 1)
Set td_s = chrome.FindElementsBytag("td")
For Each Z In td_s
If Z.attribute("headers") = "price_header1" Then w = w + 1: ar(w, 1) = Z.Text
Next
Cells.ClearContents
Cells(1, 1).Resize(w, 1) = ar
End Sub作者: DanielWONG 時間: 2022-11-20 10:46