• Introduction
BELT internally use COM object InternetExplorer.Application to communicate with IE.
It contains following cmdlets:
Click-BrowserElement
Get-BrowserElementProperty
Get-IEBrowser
New-IEBrowser
Select-BrowserElement
Set-BrowserElement

  • Installation
./install.ps1
./uninstall.ps1
  • Usage
PS D:\codeplex\BELT\BELT\bin\Release> Add-PSSnapin BELT
PS D:\codeplex\BELT\BELT\bin\Release> New-IEBrowser -StartURL google.com

Name
----
Windows Internet Explorer

PS D:\codeplex\BELT\BELT\bin\Release> Select-BrowserElement -TagName input

Type       Name                 Value
----       ----                 -----
hidden     hl                   en
hidden     source               hp
hidden     biw                  780
hidden     bih                  436
text       q
submit     btnG                 Google Search
submit     btnI                 I'm Feeling Lucky
hidden     aq                   f
hidden     aqi
hidden     aql
hidden     oq
hidden     gs_rfai

PS D:\codeplex\BELT\BELT\bin\Release> Select-BrowserElement -TagName input -Type text | Set-BrowserElement -Value BELT
PS D:\codeplex\BELT\BELT\bin\Release> Select-BrowserElement -TagName input -Name btnG | Click-BrowserElement

PS D:\codeplex\BELT\BELT\bin\Release> Navigate-IEBrowser codeplex.com -WaitIE
PS D:\codeplex\BELT\BELT\bin\Release> Navigate-IEBrowser codeplex.com ; Wait-IEBrowser

PS D:\codeplex\BELT\BELT\bin\Release> Close-IEBrowser

  • Shortness
For now, BELT does not support locating elements nested in IFrame.
I met an annoying problem:
$ie.document.getElementsByTagName("iframe")[0].contentDocument
This line does not work in PowerShell. I have searched this issue online for quite a lot of time. Still got no answer.
If anybody knows why, please tell me the solution. Then, I can make BELT more powerful.

Last edited Nov 29, 2010 at 7:18 AM by priezt, version 8

Comments

No comments yet.