8 responses to “Using PowerShell and WatiN (PowerWatin?)”

  1. Klaus Schulte

    Hello Joel,

    having been enthusiastic of the way to generate a bunch of functions from the DLL, I tried to reproduce your results.
    Naively I copied the code into the ISE and called “Start-Watin” with no functions being generated:

    ___________________________________________________________________________________________________________________________________
    PS C:\Dokumente und Einstellungen\Schulte> dir Function:F*

    CommandType Name Definition
    —————- —— —————
    Function F: Set-Location F:

    OK … I did find out, that the functions have been defined inside the “Start-Watin” function itself and that they are out of scope when that function ends.

    That brings up the question: Is there a way to let the generated functions “survive” the end of the generator function? .. something like the $global: prefix?

    ( I’m starting to learn PS … and I hope the question is not too silly :-)

    kind regards, Klaus

  2. Adam Kozmic

    Hi Joel. Good stuff, last year we actually worked on an engine that would push all Watin calls to an STA thread running in the background, and then pull the results of the call back to our original thread….it was quite the nightmare, and while it worked, it was buggy.

    Needless to say, I am excited for the possibilities in Powershell CTP3.

    I messed around with your code and tried some of my own, and the one thing I’m noticing is that attempting to find an element that isn’t there takes a very long time to fail …sometimes it doesn’t come back at all. It just sits there. I’m wondering if this is related to powershell itself. Perhaps the way that Powershell handles STA results in some weird threading issue which doesn’t allow the timeout to happen? Have you seen this as well?

    Thanks,
    Adam

  3. wasabi

    I love this article. It’s a great primer! Jaykul, how do you parse a column in table list on a website?

  4. wasabi

    Joel, you are my hero!