本文介绍了使用VBA单击IE中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在寻找一种方法来点击网页上的按钮来自动导出。
I'm currently looking for a way to click on a button on a web page to automate an export.
我已经成功登录到网页并点击登录按钮重定向页面,但是我无法点击我正在寻找的下一个按钮。
I've already succeeded with logging in to the web page and clicking on the login button to redirect the page, but then I could not click on the next button i'm looking for.
我的代码:
For Each ele In IE.document.getElementsByTagName("ul")
If ele.document.getElementsByTagName("a").getAttribute("aria-labelledby") = "Exporter vers CSV" Then ele.Click
Next
网站来源:
<ul class="dropdown-menu pull-left">
<!-- ngRepeat: item in secondaryItems track by item.dataAid --><li ng-repeat="item in secondaryItems track by item.dataAid" class="">
<a role="button" ng-show="item.visible" aria-labelledby="Exporter vers CSV" data-aid="tool-bar-inner-dd-btn-export" type="submit" ng-disabled="!item.enabled" ng-class="{plToolbarItemDisabled:!item.enabled, disabled:!item.enabled}" class="grid-export-item-btn" ng-click="item.callback(item, $event)" pl-toolbar-button-in-dropdown="" item="item">
推荐答案
我不能在不知道你的网址的情况下测试它,但是这个maywork:
I cannot test it without knowing your URL, but this maywork:
For Each ele In IE.document.getElementsByTagName("ul")
For Each ele2 In ele.getElementsByTagName("a")
If InStr(ele2.InnerHtml, "aria-labelledby=""Exporter vers CSV""") Then ele2.Click
Next ele2
Next ele
这篇关于使用VBA单击IE中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!