【发布时间】:2020-01-23 16:14:16
【问题描述】:
我正在自动下载报告。有一个需要更改为“已启动”值的状态下拉列表。我已经设法更改了代码中的值,但是当您手动进行更改时,站点的报告屏幕会自动更新。我的代码无法做到这一点。
我想知道是否有可能需要更改的额外元素。有人知道我错过了什么吗?
网站上的元素:
<select data-bind="value: leads.overall_status, options: [null, 'not_started', 'quoted_with_quotes', 'quoted_without_quotes', 'started', 'open_accounts'], optionsText: BrokerLeadsGridModel.overall_status_renderer" style="width: 160px;vertical-align: baseline;display: inline;" class="form-control">
<option value="">Any</option>
<option value="not_started">Not Started</option>
<option value="quoted_with_quotes">Quoted</option>
<option value="quoted_without_quotes">No Quotes</option>
<option value="started">Started</option>
<option value="open_accounts">Open</option>
</select>
我的代码:
Doc.getElementsByClassName("form-control")(0).Value = "started"
【问题讨论】:
-
你试过
.fireevent ("onclick")吗? -
嗨@Daniel,我没有。我将如何在我的代码中使用它?
-
在您的代码或选择值后添加
Doc.getElementsByClassName("form-control")(0).fireevent ("onclick")- 您也可以尝试“onchange”而不是“onclick”,我只是盲目猜测 -
谢谢@Daniel,我试了一下,但两个建议都没有更新。不过,我相信这在未来会有所帮助。
标签: vba internet-explorer web-scraping automation