我有问题,因为我的代码没有执行.click命令!
Sub getdata()
Dim ie As New InternetExplorer
ie.Visible = True
ie.navigate "https://app.scheduleonce.com/Home.aspx"
With ie
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
End With
Dim doc As HTMLDocument
Set doc = ie.document
Set dfrom = doc.getElementById("TxtDateFrom")
dfrom.Value = "Dec 01, 2017"
Set dto = doc.getElementById("TxtDateTo")
dto.Value = "Jan 31, 2018"
Set btn = doc.getElementsByTagName("input")(12)
btn.Click
With ie
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
End With
Dim mt As String
For IDn = 1 To 100
mt = doc.getElementById("rowID_" & IDn).innerText
Sheets(1).Range("a" & IDn) = mt
Next IDn
End Sub
这里有来自HTML的困扰:
<input type="button" value="Go" class="btn" style="" onclick="DateFilter();">
所以一般来说,大多数代码都可以工作,它会在指定页面上运行,它会将日历值更改为我想要的,它会将数据从页面复制到excel,但是......
更改日期范围后没有点击按钮,因此永远不会应用更改!
我已经检查了哪个标签“输入”并且它是第12个(在以下情况下也尝试了13个)!
如何点击按钮并应用更改日期?
这是DATE FROM框的HTML:
<div id="datediv" style="">
<div class="filderItems">
<div class="homeFilters">
<div class="boldText">
From:
<input id="TxtDateFrom" style="" class="calendertbs" onclick="OpenDatePicker('CalDivFrom', 'TxtDateFrom'); blur(); return false;"
readonly="readonly" type="text" value="" />
<span onclick="OpenDatePicker('CalDivFrom', 'TxtDateFrom'); return false;" style="cursor: pointer">
<img id="CalDivFrom" src="//cdn.scheduleonce.com/images/calender_icon.jpg" alt="" />
</span>
</div>
</div>
</div>
<div class="filderItems">
<div class="homeFilters ml10">
<div class="boldText">
它与我的VBA代码接缝我只更改了TXTbox但实际上并没有更改日期所以它看起来只是我选择了某些数据范围但实际上我没有![/ p>
这是PRNTSCR。文本已更改,但实际上日期未从选择器中选取,并且可能未应用该方式!
如何在数据选择器中选择日期?