Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell is auto logging me into website?

$
0
0

I ran this code and it allowed me to login to the website and it downloaded everything into a text file, but after the first try it as been giving me an error: "Property 'value' cannot be found on this object make sure it exists and is settable." It's been about an hour since I ran it and it worked and I didn't change the code. I cleared the cookies in internet explorer and deleted everything out of the appdata cookies folder (Only reason I could figure it was doing this was because I was already logged into the page).

I just edited the script so that it doesn't try to login first and just grabs the page and for some reason the script it automatically logging me in now, because it's returning the information that is only view able once you login. What could cause this and how do I make it where it has to login each time?

Here is the powershell code:

$username = "user" 
$password = "pass" 
$ie = New-Object -com InternetExplorer.Application 
$ie.visible=$false
$ie.navigate("website") 
while($ie.ReadyState -ne 4) {start-sleep -m 100} 
$ie.document.getElementById("username").value = "$username" 
$ie.document.getElementById("password").value = "$password" 
$ie.document.getElementById("click").click()
start-sleep 20 
$ie.Document.body | Out-File -FilePath c:\web.txt 

Here is the website code:

form method="POST" action="login.php" name="loginform"><div class="login" align="center"><p class="indent">Sign-in to your account</p></div><div class="loginbot"><div class="email">Email Address: <br /><input name="username" type="text" value="" size="25" /><br /><input type="checkbox" name="remember" value="checkbox" class="small_chk1" value="ON"/>Automatically sign-in<br /></div><div class="pass">Password:<br /><input name="password" type="password" size="25" /><br /><a href="login.php?ti=password">Forgot your password?</a><br /></p></div></div><div class="logbut"><input type="hidden" name="ti" value="do_login"><input type="submit" value="Login ->" name="click" style="border-style: outset; border-width: 1; font-family:Verdana; color:#FFFFFF; font-size:10pt; background-image:url('images/clickbg.gif')"></div><br /><br /></form>



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>