Automate a login script and exit Website - Problem with login in function
hello all,
i've started working on script login site automatically , have output log file.
the problem have button (login nutton) line of code in script, i'm not sure if working or not , need , log file include url , success or fail next url.
eventually -content txt file , have sites in list same login
(the inspect elemment feature on login page (chrome) shows these details login button)
function loginie { $ie = new-object -com "internetexplorer.application" $ie.navigate("http://url.com") $ie.visible = $true { 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 }
hi ritesh,
please try script below , feedback, please note haven't tested.
$username = "userid" $password = "password" $ie = new-object -com internetexplorer.application $ie.visible=$true $ie.navigate("url") while($ie.readystate -ne 4) {start-sleep -m 100} $ie.document.getelementbyid("text1").value= $username $ie.document.getelementbyid("password").value = $password $ie.document.getelementbyid("buttonlogin").click() while ($ie.busy -eq $true){ start-sleep -milliseconds 1000} $ie.document.documentelement.innertext |out-file d:\20140306.txt if have feedback on our support, please click here.
best regards,
anna
technet community support
Windows Server > Windows PowerShell
Comments
Post a Comment