首页 > 解决方案 > 使用 Powershell 通过 IE 使用 JavaScript 时的空文档

问题描述

我正在编写一个脚本来自动化工作中的无用任务。通常,一切都很好,但有时会运行 JavaScript 以加载特定页面,然后我的所有文档都是空的。

示例:

$Page = New-Object -ComObject «InternetExplorer.Application»
...
$frame = $Page.document.frames
...

# The script navigates well, set some values get others everything is fine and then:

$frame.item(3).IHTMLDocument3_getElementById(«oAff1»).children[0].(...).click()

# It does the click, the browser loads the new page and:

$frame.item(3).document

# Returns nothing, it seems to load in IE but not for Powershell who still see a white page. 

有任何想法吗?

标签: powershellinternet-explorerinternet-explorer-11

解决方案


推荐阅读