【问题标题】:powershell com internetexplorer catch popup windowpowershell com internetexplorer 捕获弹出窗口
【发布时间】:2015-10-22 10:01:20
【问题描述】:

我正在尝试使用 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?

谢谢!

【问题讨论】:

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


    【解决方案1】:

    尝试使用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)
    

    【讨论】:

    • 我也不知道怎么做,但你可以试试$ie.NewWindow3 = { param(...) # rest of function definition }。根据文档,它看起来可能是这样。
    猜你喜欢
    • 1970-01-01
    • 2010-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-26
    • 2010-10-12
    • 1970-01-01
    相关资源
    最近更新 更多