luny Posted February 28, 2017 Posted February 28, 2017 (edited) Hello all, this is what I got so far .. it opens and It won't put in words, I need to log in,, oops didnt put in code. LOL #include <IE.au3> Local $oUser, $oPass, $oSubmit Local $sUser = "lit" Local $sPass = "abc" Local $url = "http://woodstock:9090/login.jsp?url=%2Findex.jsp" Local $oIE = _IECreate($url, 1) _IELoadWait($oIE) $oInputs = _IETagNameGetCollection($oIE, "input") for $oInput in $oInputs if $oInput.type = "text" And $oInput.name = "userid" And $oInput.size = "12" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "password" And $oInput.size = "12" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.value = "loginformtable" Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next $oUser.value = $sUser $oPass.value = $sPass _IEAction($oSubmit, "click") _IELoadWait($oIE) 1 Edited February 28, 2017 by luny
luny Posted February 28, 2017 Author Posted February 28, 2017 IT starts a webpage and CREDENTIALS NEVER POPULATE oops sorry for yelling
Subz Posted February 28, 2017 Posted February 28, 2017 Try: #include <IE.au3> Local $oUser, $oPass, $oSubmit Local $sUser = "lit" Local $sPass = "abc" Local $url = "http://woodstock:9090/login.jsp?url=%2Findex.jsp" Local $oIE = _IECreate($url, 1) _IELoadWait($oIE) $oInputs = _IETagNameGetCollection($oIE, "input") for $oInput in $oInputs If $oInput.name = "userid" Then $oInput.value = $sUser If $oInput.name = "password" Then $oInput.value = $sPass if $oInput.value = "loginformtable" Then _IEAction($oInput, "click") Next
luny Posted March 1, 2017 Author Posted March 1, 2017 ill try that,, I see now I didnt have the click high enough Brain fart..
luny Posted March 1, 2017 Author Posted March 1, 2017 (edited) I put in my actual credentials,, and it did not add them in,,it just opened and sat.. there.. waiting for me.. should this be higher on original ?? $oUser.value = $sUser $oPass.value = $sPass _IEAction($oSubmit, "click") back to studying I guess, any help would be appreciated.. I am an admin, I add the same person to 20 differnt peoples profile.. so it repetitive.. but I need to log in,, maybe once logged in, I can run auto it after that?? thats a an idea.. My plan is to run auto it, I will show a menu,, what am I adding for : PLACE-A to PLACE_B or C or D or E. then how many users from a, needed (3) and how many from b (4) i will add info, anf it wil run and add to each of the users from each other.. That is my plan. I have made a couple menus. so I got that part. but I am trying to run it,, answer questions it loggs in, adds them, and sends email out saying it was done THAT is the plan.. so I will be here alot. Get used to me. AutoIT WILL be my bitch.. lol Edited March 1, 2017 by luny
Subz Posted March 1, 2017 Posted March 1, 2017 Just re-run with IE open sometimes it goes through the loop too early.
luny Posted March 1, 2017 Author Posted March 1, 2017 oh ok.. also, in yours, I dont see submit.. $0submit, button used, I believe it is called that, so wouldn't that terminology need to be int here??
Subz Posted March 1, 2017 Posted March 1, 2017 No basically it iterates through the inputs and when it finds: loginformtable then it knows that the input is the Submit button it then clicks that Input.
luny Posted March 1, 2017 Author Posted March 1, 2017 oh ok, I was wondering, am I missing something it opens, and does nOT input anything, it doesn't even say wrong name or password, hmm.. this looks like a job for SEARCH ENGINE>>>lol
luny Posted March 1, 2017 Author Posted March 1, 2017 SO can anyone give me, help on LOGGING in, and then it INPUTTING username andPASSword for same ??
luny Posted March 1, 2017 Author Posted March 1, 2017 yes I can, I think that's why it's not working, I have to learn more what HTML is saying, I was using username and password, to enter my parameters. Thank you again for any help. IM tryin, I have used 5 different configurations, all of them open browser but credentials do NOT populate. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Openfire Admin Console</title> <script language="JavaScript" type="text/javascript"> <!-- // break out of frames if (self.parent.frames.length != 0) { self.parent.location=document.location; } function updateFields(el) { if (el.checked) { document.loginForm.username.disabled = true; document.loginForm.password.disabled = true; } else { document.loginForm.username.disabled = false; document.loginForm.password.disabled = false; document.loginForm.username.focus(); } } //--> </script> <link rel="stylesheet" href="style/global.css" type="text/css"> <link rel="stylesheet" href="style/login.css" type="text/css"> </head> <body> <form action="login.jsp" name="loginForm" method="post"> <input type="hidden" name="url" value="/index.jsp"> <input type="hidden" name="login" value="true"> <div align="center"> <!-- BEGIN login box --> <div id="jive-loginBox"> <div align="center" id="jive-loginTable"> <span id="jive-login-header" style="background: transparent url(images/login_logo.gif) no-repeat left; padding: 29px 0 10px 205px;"> Administration Console </span> <div style="text-align: center; width: 380px;"> <table cellpadding="0" cellspacing="0" border="0" align="center"> <tr> <td align="right" class="loginFormTable"> <table cellpadding="2" cellspacing="0" border="0"> <noscript> <tr> <td colspan="3"> <table cellpadding="0" cellspacing="0" border="0"> <tr valign="top"> <td><img src="images/error-16x16.gif" width="16" height="16" border="0" alt="" vspace="2"></td> <td><div class="jive-error-text" style="padding-left:5px; color:#cc0000;">Error: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page.</div></td> </tr> </table> </td> </tr> </noscript> <tr> <td><input type="text" name="username" size="15" maxlength="50" id="u01" value=""></td> <td><input type="password" name="password" size="15" maxlength="50" id="p01"></td> <td align="center"><input type="submit" value=" Login "></td> </tr> <tr valign="top"> <td class="jive-login-label"><label for="u01">username</label></td> <td class="jive-login-label"><label for="p01">password</label></td> <td> </td> </tr> </table> </td> </tr> <tr> <td align="right"> <div align="right" id="jive-loginVersion"> Openfire, Version: 3.7.1 </div> </td> </tr> </table> </div> </div> </div> <!-- END login box --> </div> </form> <script language="JavaScript" type="text/javascript"> <!-- if (document.loginForm.username.value == '') { document.loginForm.username.focus(); } else { document.loginForm.password.focus(); } //--> </script> </body> </html>
Subz Posted March 1, 2017 Posted March 1, 2017 This works fine for me: #include <IE.au3> Local $sUsername = 'lit' Local $sPassword = 'abc' Local $oIE = _IECreate("http://woodstock:9090/login.jsp?url=%2Findex.jsp", 1) Local $oInputs = _IETagNameGetCollection($oIE, "Input") For $oInput In $oInputs If $oInput.name = 'username' Then $oInput.value = $sUsername If $oInput.name = 'password' Then $oInput.value = $sPassword If $oInput.type = 'submit' Then _IEAction($oInput, "Click") Next You can also use: #include <IE.au3> Local $sUsername = 'lit' Local $sPassword = 'abc' Local $oIE = _IECreate("http://woodstock:9090/login.jsp?url=%2Findex.jsp", 1) Local $oForm = _IEFormGetObjByName($oIE, "loginform") Local $oUsername = _IEFormElementGetObjByName($oForm, "username") _IEFormElementSetValue($oUsername, $sUsername) Local $oPassword = _IEFormElementGetObjByName($oForm, "password") _IEFormElementSetValue($oPassword, $sPassword) _IEFormSubmit($oForm)
luny Posted March 2, 2017 Author Posted March 2, 2017 I used both, it opens, but no credentials, populate..it doesn't even say login error, I guess I can log ing, and then run, a script to add users, I'll try that. I'll leave this up, so if I can figure this out, maybe I can help someone else.. I mean we are a team after all. Thank you very much for the help
Subz Posted March 2, 2017 Posted March 2, 2017 You could try adding #RequireAdmin to the top and compiling the script first, but on my system I just copied your file above into a local file, ran both scripts above and it completed the form and submitted so I'm guessing its something environmental rather than code based.
Subz Posted March 2, 2017 Posted March 2, 2017 Actually ignore my last post, remove #RequireAdmin and then run the script from within Scite and let us know what errors show in the console. You may need to put a Sleep(3000) to sleep 3 seconds or it might need to be longer after _IECreate function. I'm going to be away from my system for the next couple of hours so won't be able to respond until then.
luny Posted March 2, 2017 Author Posted March 2, 2017 thank you ill try that i thought it might need a sleep as I put on on from my ,, learning
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now