Quantcast
Viewing all articles
Browse latest Browse all 21975

Automate a login script and exit Website - Problem with login in function

Hello All, 

I've started working on a script to login to a site automatically and have an output log file. 

The problem i have is the button (login nutton) line of code in my script, i'm not sure if it working or not and need some help and also would like the log file to include the URL and Success or Fail next to the URL. 

Image may be NSFW.
Clik here to view.

eventually then i would like to get -content from a txt file and have all the sites in the list with the same login  

(The inspect elemment feature on the login page (chrome) shows these details for the login button) 

function loginIE
{
$ie = New-Object -com "InternetExplorer.Application"
$ie.Navigate("http://URL.com")
$ie.visible = $true

do { sleep 5 }
while ( $ie.busy )

$doc = $ie.document
$user = $doc.getElementById("Login")
$password = $doc.getElementById("Password")
$submit = $doc.getElementById("Submit")

$user.value = "USER1"
$password.value = "USER2"
$submit.Click();

$ie.Quit();

$ie.Document.body | Out-File -FilePath c:\weblogin.txt
}





Viewing all articles
Browse latest Browse all 21975

Trending Articles