Html 单击带有powershell automation的按钮

Html 单击带有powershell automation的按钮,html,powershell,com,Html,Powershell,Com,无法单击按钮,我尝试的一切都不起作用 $ie.Document.IHTMLDocument3_getElementByID("save_desktop").click() 及 及 它需要第一部分,但它不喜欢。单击,我已经尝试了。提交以及,似乎没有任何工作 <span class="tip ng-binding" id="save_desktop" style="color: black !important;">Save / Print this bill (PDF)</sp

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

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

它需要第一部分,但它不喜欢。单击,我已经尝试了。提交以及,似乎没有任何工作

<span class="tip ng-binding" id="save_desktop" style="color: black
!important;">Save / Print this bill (PDF)</span>
保存/打印此账单(PDF)
错误:

不能调用空表达式

方法调用失败,因为[System.DBNull]不包含 名为“click”的方法。第1行字符:1 +$ie.Document.getElementById('save_desktop')。单击()

我添加了更多信息:


ng click=“bbTrackData('events',true,'bill:save:print this bill')” >tooltip trigger=“单击”tooltip placement=“左下角” >工具提示html unsafe=“class=“downloadPdfEbuText”>下载:class=“d-iflex”>class=“cus-icon-rogers\u overlay-arrow-circle”>onclick=“downloadpcompletebill('14161234567-123456789')” >class=“downloadPdfEbuLink rogers”>完成 >比尔class=“cus-icon-rogers\u overlay-arrow-circle”>onclick=“downloadAccountSummary('1-1234-5678','24092019')” >class=“downloadPdfEbuLink rogers”>帐户 >摘要“>class=“tip ng binding”id=“保存桌面”style=“颜色:黑色 >!重要;“>保存/打印此账单(PDF)

这应该行得通,
($ie.Document.IHTMLDocument3_getElementByID('save_desktop'))|选择-first 1)。单击()
我已经根据测试文档测试了这一行,它按预期工作,并触发一个
onclick
事件,因此我认为您的代码本身没有任何问题。您能否通过运行
($ie.Document.IHTMLDocument3\u getElementByID('save_desktop'))|选择-first 1.getType()
)来确认您拥有的对象类型。此外,您是否确定此
span
是要单击的元素,并且它周围没有锚之类的东西?我知道您有,但没有收到任何答复。我想你应该展示更多的HTML,这样我们就可以知道
是否被
包围了。我也尝试过这些,但运气不好。不能对空值表达式调用方法。在第1行中,字符:1+($ie.Document.IHTMLDocument3\u getElementByID('save_desktop');选择…+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~类别信息:无效,RuntimeException+FullyQualifiedErrorId:InvokeMethodUnull get类型告诉我:不能对空值表达式调用方法。第1行char:1+($ie.Document.IHTMLDocument3_getElementByID('save_desktop'))|选择…+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~类别信息:无效操作:(:)[,RuntimeException+FullyQualifiedErrorId:InvokeMethodonulli在顶部添加了更多信息,谢谢大家。
$ie.Document.IHTMLDocument3_getElementByID('save_desktop') | select -first 1).click()
<span class="tip ng-binding" id="save_desktop" style="color: black
!important;">Save / Print this bill (PDF)</span>
> <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>