Search code examples
powershellwatin

AttachTo IE browser using Watin and Powershell


I am having problems using AttachTo with Powershell. I searched, but can't find any Powershell example that uses AttachTo.

This doesn't work: $ie2 = $ie.AttachToIE([watin.core.Find]::ByTitle("Task Selection"))

I guess I am not sure of the syntax. The .NET uses which doesn't work in PS.


Solution

  • Try this:

    $ie = (New-Object -COM 'Shell.Application').Windows() | ? {
            $_.Name -eq 'Windows Internet Explorer' -and
            $_.LocationName -eq 'Task Selection'
          }