为了账号安全,请及时绑定邮箱和手机立即绑定

.GetElementsByName.SelectedIndex 明显改变选项但不是以编程方式?

.GetElementsByName.SelectedIndex 明显改变选项但不是以编程方式?

阿晨1998 2021-06-29 15:43:47
我遇到了一个问题,不知道如何解决它,在 Excel VBA 中,我有这个代码可以带我浏览一个网站(https://indexcalculator.ftserussell.com/),但是在我更改网站的第 3 步时通过 vba 选择的索引我可以看到它们在网页上发生了变化,但是当点击下一页按钮时,它就好像从未被点击过一样。选定的指数变化:点击获取退货后:months = Format(DateSerial(year(Date), month(Date) - 1, 1), "m")    days = Format(DateSerial(year(Date), month(Date), 0), "d")    years = CInt(Format(DateSerial(year(Date), month(Date) - 1, 1), "yyyy")) - 1994    Application.Wait (Now + TimeValue("0:00:01"))    'If the year pops up blank that means that the base year is no longer 1994    HTMLdoc.getElementsByName("m_startDate")(0).selectedIndex = CInt(months - 1)    HTMLdoc.getElementsByName("d_startDate")(0).selectedIndex = CInt(days - 1)    HTMLdoc.getElementsByName("y_startDate")(0).selectedIndex = years    Application.Wait (Now + TimeValue("0:00:02"))    Set oButton = HTMLdoc.querySelector("a[href='javascript:submitForm(document.forms[0].action);']")    oButton.Click    Application.Wait (Now + TimeValue("0:00:01"))    Set oButton = HTMLdoc.querySelector("a[href='javascript:document.forms[0].target='_blank';submitForm('IndexDownload.aspx');']")    oButton.Click第 4 步页面应该说的是 5 月 31 日而不是 6 月 13 日,当我手动执行时,它可以工作。为什么会发生这种情况?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 203 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信