Hi!
I am trying to login to a free, public, registration-required forum but
I got some problem.
function Login-Forex{
param(
[string]$uname,
[string]$url="http://www.testsitecom/",
[bool]$cookie=$FALSE
)
$creds = get-credential $uname
$pass = $creds.GetNetworkCredential().Password
$user = $creds.GetNetworkCredential().username
$ie=new-object -com internetexplorer.application
$ie.visible=$FALSE
$ie.navigate($url)
# while($ie.ReadyState -ne 4) {start-sleep -Milliseconds 1}
Start-Sleep -Seconds 5
$ie.document.getElementById("navbar_username").value = $user
$ie.document.getElementById("navbar_password").value = $pass
# $ie.document.getElementsByName("PersistentCookie") | foreach
{$_.checked=$cookie}
$forms = @($ie.Document.forms | where {$_.action -match "do=login"})
Start-Sleep -Seconds 5
# $ie.document.getElementById("Log In").submit()
$forms[0].submit()
}
Login-Forex xxxx
For some reason, navbar_username and navbar_password gets null.
So if these are null, $user and $pass should be submitted.
Please advise how to write it.
Thanks in advance.
pjo:surrender
--
pjo
http://www.techtalkz.com - Technology and Computer Troubleshooting Forums


