首页 > 解决方案 > 单击具有 powershell 自动化功能的按钮

问题描述

无法单击按钮,我尝试的一切都不起作用。

$ie.Document.IHTMLDocument3_getElementByID("save_desktop").click()

$Link=$ie.Document.getElementsByTagName("span") | where-object {$_.type -eq "Save / Print this bill (PDF)"}
$Link.click();

$ie.Document.IHTMLDocument3_getElementByID('save_desktop') | select -first 1).click()

它需要第一部分,但它不喜欢.click,我也尝试过.submit,似乎没有任何效果!

<span class="tip ng-binding" id="save_desktop" style="color: black
!important;">Save / Print this bill (PDF)</span>

错误:

您不能调用空表达式

方法调用失败,因为 [System.DBNull] 不包含名为“click”的方法。在 line:1 char:1 + $ie.Document.getElementById('save_desktop').Click()

我添加了更多信息:


> <span class="print-save-pdf-link ng-scope"
> ng-click="bbTrackData('events',true,'bill:save:print this bill')"
> tooltip-trigger="click" tooltip-placement="bottom-left"
> tooltip-html-unsafe="<div
> class=&quot;downloadPdfEbuText&quot;>Download:</div><div
> class=&quot;d-iflex&quot;><i
> class=&quot;cus-icon-rogers_overlay-arrow-circle&quot;></i><span
> onclick=&quot;downloadCompleteBill('14161234567-123456789')&quot;
> class=&quot;downloadPdfEbuLink-rogers&quot;>Complete
> bill</span></div><div class=&quot;d-iflex&quot;><i
> class=&quot;cus-icon-rogers_overlay-arrow-circle&quot;></i><span
> onclick=&quot;downloadAccountSummary('1-1234-5678','24092019')&quot;
> class=&quot;downloadPdfEbuLink-rogers&quot;>Account
> summary</span></div>"><i class="cus-icon-download"></i><span
> class="tip ng-binding" id="save_desktop" style="color: black
> !important;">Save / Print this bill (PDF)</span></span>

标签: htmlpowershellcom

解决方案


推荐阅读