powerShell Web automation simplified! Inspired by jQuery's ease of use.
pQuery is a work in progress. Forks/Pulls Welcome.
This module is meant to create a variable that we can use jQuery-like syntax to do jQuery-like manipulations on a website.
- Download repository
- Unzip. Unlock .dll files in pQuery directory. (Right click file->Properties->Unblock->OK).
- Move pQuery folder to %UserProfile%\Documents\WindowsPowerShell\Modules
- Open up PowerShell and import the module
- Import-Module pQuery
$pQuery | GM
This should be the first function that you run.
$pQuery.Init()
Only needed if site is behind basic authentication.
$pQuery.setCredentials("username:password")
$pQuery.Navigate("http://github.com/misterGF")
Types can be button, div, form, input or a.
$pQuery.getHTML()
$pQuery.Select("button") #By Type
$pQuery.Select("#button") #By ID
$pQuery.Select(".button") #By Class
$pQuery.getText("button") #By Type
$pQuery.getText("#button") #By ID
$pQuery.getText(".button") #By Class
Set the text value based on your selector. Optionally return boolean value
$pQuery.setText("button","My Modified Text") #By Type
$pQuery.setText("#button","My Modified Text") #By ID
$pQuery.setText(".button","My Modified Text", $true) #By Class and optionally return $true or $false. Useful for unit testing.
Currently Supporting buttons and links.
$pQuery.click("#greenBtn") #By ID
$pQuery.click(".buttons", $true) #By Class and optionally return $true or $false. Useful for unit testing.
Submit a form.
$pQuery.submit("#formBtn") #By ID
$pQuery.submit(".formBtn", $true) #By Class and optionally return $true or $false. Useful for unit testing.