Author Posts

January 1, 2012 at 12:00 am

by Shellshocked at 2013-03-15 11:12:08

Hello,

I'm new to Powershell and was wanting to get some help with a script. I was trying to create a script to auto logon to a website. Currently my script will open the web page but after that nothing happens. I was hoping some one could review my script and the source of the web page and help with where i'm going wrong. I will post the script and the source page below.

Script

$username = "name"
$password = "password"

$ie = New-Object -comobject InternetExplorer.Application
$ie.visible = $true
$ie.silent = $true
$ie.Navigate( "http://site&quot😉
while($ie.ReadyState -ne 4){Start-Sleep -m 100}
$ie.Document.getElementById("webUsername").value = "$username"
$ie.Document.getElementById("webPassword").value = "$password"
$ie.Document.getElementById("submit").IHTMLElement_click()

Source


Login

User ID

Password

by DonJ at 2013-03-16 09:08:11

You're using GetElementByID but the submit button doesn't have an ID. Its type attribute does not constitute an ID attribute. In fact, none of the input elements have an ID – a "name" is also not "id."