对internet explorer DOM对象的更改未更改powershell中的DomeElement

对internet explorer DOM对象的更改未更改powershell中的DomeElement,powershell,internet-explorer,Powershell,Internet Explorer,我正试图通过使用powershell的web界面与第三方供应商实现流程自动化 登录过程之后是一个弹出窗口。在单击“登录”按钮之前,html中不存在此弹出窗口。通过在firefox inspector中检查html,我可以看到单击后发生的更改 我遇到的问题是DomeElement对象没有反映Internet Explorer中DOM发生的更改。是否有方法刷新/重新加载对象 我无法与这个弹出菜单交互,因为我无法控制它的按钮 $ie=新对象-com对象'internetExplorer.Applica

我正试图通过使用powershell的web界面与第三方供应商实现流程自动化

登录过程之后是一个弹出窗口。在单击“登录”按钮之前,html中不存在此弹出窗口。通过在firefox inspector中检查html,我可以看到单击后发生的更改

我遇到的问题是DomeElement对象没有反映Internet Explorer中DOM发生的更改。是否有方法刷新/重新加载对象

我无法与这个弹出菜单交互,因为我无法控制它的按钮

$ie=新对象-com对象'internetExplorer.Application'
$ie.Visible=$true#使其可见
$facility=“*******”
$username=“*******”
$password=“*******”
$ie.Navigate(”https://udsmrweb.udsmr.org/UDSCentral2015/CentralLogin/Index")
While($ie.Busy-eq$true){Start Sleep-Seconds 3;}
$facilityfield=$ie.document.getElementByID('txtFacility'))
$facilityfield.value=“$facility”
$userfield=$ie.document.getElementByID('txtLoginName')
$userfield.value=“$username”
$passwordfield=$ie.document.getElementByID('txtPassword'))
$passwordfield.value=“$password”
$Link=$ie.document.getElementByID('btnCredLogin')
$Link.click()
While($ie.Busy-eq$true){Start Sleep-Seconds 3;}
$butt=$ie.Document.getElementsByTagName(“输入”)
foreach($butt中的按钮){
写入主机($button | Format table | out string)
}

最后一个foreach获取来自DOM的所有输入,但是返回的那些不包括弹出窗口中的2个输入,但它们在html中。

我在我的身边重现了这个问题。因为我没有帐户,所以我可以测试直到显示。如果使用您提供的脚本,我可以获得除了弹出窗口中的“OK”按钮之外的所有输入

我认为这是因为弹出窗口的DOM尚未完全加载,但是已经执行了
foreach
方法。因此,在我想要获取以下输入之前,我添加了另一个等待,然后我可以在弹出窗口中获得“OK”按钮:

While ($ie.Busy -eq $true) {Start-Sleep -Seconds 3;}

Start-Sleep 5  # another wait 

$butt = $ie.Document.getElementsByTagName("input") 

foreach ( $button in $butt ) {
    write-host( $button | Format-table | out-string )
}
我想你的情况也一样。您可以尝试在获取输入之前添加另一个等待