VBA抓取网站(使用javascript?)

VBA抓取网站(使用javascript?),javascript,dynamic,Javascript,Dynamic,我正试图通过VBA从tab.com.au中提取数据。当我更改下拉列表的值时,我不知道如何更新站点。在我的新手看来,下拉列表似乎没有元素ID 该网站是tab.com.au。单击左上角的菜单时,将显示一个导航窗格。导航窗格底部是下拉列表,其中包含ACT、NSW或VIC值。如果手动更改下拉列表的值,网站将重新加载引用新选定值的内容 为了给网站提供一点背景,它包含了比赛信息,其中3个不同的游泳池共享同一个页面,但具有不同的值(游泳池是他们覆盖的3个州(下拉项))。如果更改下拉列表值,则价格、评分等种族信

我正试图通过VBA从tab.com.au中提取数据。当我更改下拉列表的值时,我不知道如何更新站点。在我的新手看来,下拉列表似乎没有元素ID

该网站是tab.com.au。单击左上角的菜单时,将显示一个导航窗格。导航窗格底部是下拉列表,其中包含ACT、NSW或VIC值。如果手动更改下拉列表的值,网站将重新加载引用新选定值的内容

为了给网站提供一点背景,它包含了比赛信息,其中3个不同的游泳池共享同一个页面,但具有不同的值(游泳池是他们覆盖的3个州(下拉项))。如果更改下拉列表值,则价格、评分等种族信息将发生更改

这是我的密码---

Sub changejuris()
将iE设置为InternetExplorer:设置iE=New InternetExplorer
可见=真实
即“导航”https://www.tab.com.au/racing/2015-10-26/COONABARABRAN/CBR/R/1"
'请将url更改为“当天比赛”
请注意,上面的url在比赛后一天不可用
他们每天都将数据移动到以前的站点,因此明天无法使用相同的url加载今天的数据。
While(即忙碌或就绪状态4)
Application.Wait DateAdd(“s”,1,Now)
温德
作为IHTMLElementCollection的Dim cls
Set cls=iE.document.getElementsByClassName(“通用下拉列表”)
有时这会成为“常见的下拉列表”
或“共同下拉管辖权法案”
'取决于当前选定的管辖区
cls(0)。儿童(0)。集中注意力
cls(0).Children(0).Value=“string:vic”
cls(0).子项(0).单击
即退出
设置iE=无
端接头
Sub changejuris()

 Dim iE As InternetExplorer: Set iE = New InternetExplorer

 iE.Visible = True

iE.Navigate "https://www.tab.com.au/racing/2015-10-26/COONABARABRAN/CBR/R/1"

'please change the url to current day racing
'note that url above becomes not available a day after the race
'they move data to their previous site daily so today's data can not be loaded tomorrow using the same url.

While (iE.Busy Or iE.readyState <> 4)

 Application.Wait DateAdd("s", 1, Now)

 Wend

 Dim cls As IHTMLElementCollection

 Set cls = iE.document.getElementsByClassName("common-dropdown")

'sometimes this becomes "common-dropdown jurisdiction-vic"
 'or "common-dropdown jurisdiction-act"
 'depending on current selected jurisdiction

cls(0).Children(0).Focus

cls(0).Children(0).Value = "string:vic"

cls(0).Children(0).Click

 iE.Quit

 Set iE = Nothing

 End Sub