1

I'm trying to use powershell to automate and parse a website. Everything works great until I "click" on a link and it opens in a new window. How can I access that window so I can parse it?

$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?

Thank you!

user929542
  • 59
  • 4

1 Answers1

0

Try using the NewWindow3 event so that you can grab the object when it gets created.

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)
briantist
  • 45,546
  • 6
  • 82
  • 127
  • I am not sure how either, but you could try `$ie.NewWindow3 = { param(...) # rest of function definition }`. Based on the documentation it looks like it might be the way. – briantist Oct 22 '15 at 14:55