powershell com internetexplorer抓住弹出窗口

时间:2015-10-22 00:59:12

标签: parsing internet-explorer powershell popupwindow com-object

我试图使用powershell来自动化和解析网站。 一切都很好,直到我"点击"在链接上,它将在新窗口中打开。 如何访问该窗口以便我可以解析它?

$ie = New-Object -com Internetexplorer.application 
$ie.Visible= $true
$ie.Navigate("http:/.....")
....
# find a link... 
$link.click(); # a new popup window open up.
# how can I get access to the new popup window?

谢谢!

1 个答案:

答案 0 :(得分:0)

尝试使用NewWindow3 event,以便在创建对象时抓取该对象。

Raised when a new window is to be created. Extends NewWindow2 with additional information about the new window.
Syntax
        Private Sub object_NewWindow3( _
    ByRef ppDisp As Object, _
    ByRef Cancel As Boolean, _
    ByVal dwFlags As Long, _
    ByVal bstrUrlContext As String, _
    ByVal bstrUrl As String)