Skip to content

Instantly share code, notes, and snippets.

@cdhunt
Created March 27, 2014 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdhunt/9809635 to your computer and use it in GitHub Desktop.
Save cdhunt/9809635 to your computer and use it in GitHub Desktop.
Running automated browser tests with WatiN and PSate.
Add-Type -Path C:\WatiN\bin\net40\WatiN.Core.dll
if ( [string]::IsNullOrEmpty([psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::get["Find"]) )
{
[psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::add("Find", "WatiN.Core.Find")
}
Describing 'Bing Search' {
Given 'Search for "Automated Ops"' {
$ie = New-Object WatiN.Core.IE('http://www.bing.com/')
$ie.TextField([Find]::ByName('q')).TypeText('Automated Ops')
$ie.Button([Find]::ByName('go')).Click()
It 'Contains "Automated Ops"' {
$ie.ContainsText('Automated Ops') | Should Be $true
}
$ie.Close()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment