Marrot Posted March 8, 2016 Share Posted March 8, 2016 Hello everybody, i spent hours over hours trying to login to a specific website via script. I did a lot of research, used example code and i can't get it to work on this: <form class="login autofill" data-bind="submit:userLogin" action="https://www.one.com/admin/login.do" method="POST" novalidate=""><h1 class="welcomeText">Control Panel</h1><input type="hidden" name="loginDomain" value="true"> <input type="email" name="displayUsername" class="username" data-bind="value:loginForm.displayUsername,valueUpdate:['input','afterkeydown']" placeholder="Email" required=""> <input type="hidden" name="username" data-bind="value:loginForm.username" value=""> <input type="hidden" class="domain" data-bind="value:loginForm.targetDomain" name="targetDomain" value=""> <input type="password" class="password" data-bind="value:loginForm.password,valueUpdate:['input','afterkeydown']" name="password1" placeholder="Password"><div class="clearfix"></div> <input type="hidden" class="loginTarget" name="loginTarget" data-bind="value:loginForm.loginTarget"> <div class="loginErrors" style="display: block;"><p data-bind="visible:!loginForm.isLoginValid()" style="display: none;">The email or password you entered is incorrect. Please try again.</p><p data-bind="visible:enterUsernameAndPassword" style="display: none;">Please enter your email address and password.</p><p data-bind="visible:invalidUsername()" style="display: none;">The user name you entered is not valid.</p><p data-bind="visible:invalidPassword()" style="display: none;">The password you entered is not valid.</p><p class="boxedLoginError" data-bind="visible:loginForm.isLoginObsolete()===true" style="display: none;">Log in with your email address. It is no longer possible to log in with your domain name.<br><br> Please <a href="https://www.one.com/admin/adminuser-send-create-email.do">create a new login</a> if you haven't done it yet.<br><br> <a target="_blank" href="https://www.one.com/en/support/faq/if-you-havent-yet-created-a-new-login">If you haven't yet created a new login</a></p></div><div class="buttons"><button type="submit" class="oneButton">Log in<i class="icon-arrow-cicle"></i></button></div><p class="forgot_password"><a href="https://www.one.com/admin/forgotpassword.do">Forgot your password?</a></p><p class="forgot_password"><a href="https://www.one.com/admin/adminuser-send-create-email.do">Create new login</a></p></form> I tried another website where the form has an id and everything and it worked so either this one isn't possible or there is something else then $o_form = _IEFormGetObjByName what i don't know yet. I don't care which browser i would have to use, in order to get it to work. Just used IE as a lot of examples i found used it and it looked implementable. Thanks in advance for any help! Link to comment Share on other sites More sharing options...
alienclone Posted March 8, 2016 Share Posted March 8, 2016 (edited) I cannot test because i dont have an account there but this may work. there is only one form on the page so you it doesnt need a name. #include <IE.au3> Local $oIE = _IECreate("https://login.one.com/cp/") Local $oForm = _IEFormGetCollection($oIE, 0) Local $oQuery = _IEFormElementGetCollection($oForm, 0) Local $oQuery2 = _IEFormElementGetCollection($oForm, 1) _IEFormElementSetValue($oQuery, "Email@email.com") ; replace Email@email.com with your email _IEFormElementSetValue($oQuery2, "Password") ; replace Password with your password _IEFormSubmit($oForm) Edited March 8, 2016 by alienclone If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
Marrot Posted March 8, 2016 Author Share Posted March 8, 2016 Thanks alienclone for the fast reply. I tried your code and it puts the password into the mail field. What do i have to change? Again, thanks a lot! Link to comment Share on other sites More sharing options...
alienclone Posted March 8, 2016 Share Posted March 8, 2016 (edited) maybe change the index from 0,1 to 1,2 #include <IE.au3> Local $oIE = _IECreate("https://login.one.com/cp/") Local $oForm = _IEFormGetCollection($oIE, 0) Local $oQuery = _IEFormElementGetCollection($oForm, 1) Local $oQuery2 = _IEFormElementGetCollection($oForm, 2) _IEFormElementSetValue($oQuery, "Email@email.com") ; replace Email@email.com with your email _IEFormElementSetValue($oQuery2, "Password") ; replace Password with your password _IEFormSubmit($oForm) Edited March 8, 2016 by alienclone If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
Marrot Posted March 8, 2016 Author Share Posted March 8, 2016 I already tried that, still the same. Link to comment Share on other sites More sharing options...
alienclone Posted March 8, 2016 Share Posted March 8, 2016 ok, i am very confident this one will work, my test showed it entering into the correct fields. #include <IE.au3> Local $oIE = _IECreate("https://login.one.com/cp/") Local $oForm = _IEFormGetCollection($oIE, 0) Local $oQuery = _IEFormElementGetCollection($oForm, 1) Local $oQuery2 = _IEFormElementGetCollection($oForm, 4) _IEFormElementSetValue($oQuery, "Email@email.com") ; replace Email@email.com with your email _IEFormElementSetValue($oQuery2, "Pass") ; replace Password with your password _IEFormSubmit($oForm) If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
Marrot Posted March 8, 2016 Author Share Posted March 8, 2016 Okay, i played arround and it is 1 and 5. Can you explain me what this numbers are? what means this 1 and 5? It copies now the mail correctly but the password is copied as "password123" not "***********" and after hitting the login button it gives an error that mail or password is wrong. Can i somehow copy this password not in clear text? Link to comment Share on other sites More sharing options...
Marrot Posted March 8, 2016 Author Share Posted March 8, 2016 It seems those 2 fields are only filled with display text, not the "real" values. After it puts in the mail and i click inside the mail field, it disappears. So it looks like it puts in this pre-defined field description text but not the actual text. Do you understand what i mean? =) Link to comment Share on other sites More sharing options...
alienclone Posted March 8, 2016 Share Posted March 8, 2016 the numbers are the elements in the form, the space where you put the email address is an element and it is the first element in the form. the password box is another element, there are some invisible elements in there, play with the numbers, maybe 2 , 5 If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
Marrot Posted March 8, 2016 Author Share Posted March 8, 2016 I will play arround and test it. Thanks a lot, you really helped me a lot! Link to comment Share on other sites More sharing options...
Marrot Posted March 8, 2016 Author Share Posted March 8, 2016 After my _IEFormSubmit($oForm) command it seems the script gets stuck. It logs in perfectly but no matter what i have next in my script it won't continue. I tried with Sleep but it doesn't help. No i put _IELoadWait($oIE) after the Submit but it still doesn't continue. What else could i try? Link to comment Share on other sites More sharing options...
Marrot Posted March 8, 2016 Author Share Posted March 8, 2016 Fixed it: _IEFormSubmit($oForm, 0) _IELoadWait($oIE) Link to comment Share on other sites More sharing options...
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