666 Posted October 5, 2010 Share Posted October 5, 2010 I try to Login at a Side, where the Login is called with a javascript. So i call the js and on the Side the Login pops up. But then no Field gets filled. The Source is: <div class="Login_text"> <form action="?action=start" method=post> Nickname:<br /> <input class="input" type="text" name="form_login_name"><br /> Passwort:<br /> <input class="input" type="password" name="form_login_password"><br /> Server:<br /> <input type="radio" name="form_world" value="world1"> Welt 1 <br /> <input type="radio" name="form_world" value="world2"> Welt 2 <br /> <input class="button" type="submit" name="login" value="Login"><br /> <a class="link" href="?action=start&forgotpw=true">Forgot Password?</a> </form> </div> As the Form has no Name, ive tried it with "_IEFormGetCollection" but without success. My Script so far: $name= "xyz" $password= "xyz" $oIE= _IECreate ($url) _IENavigate($oIE,"javascript:Login();") _IeLoadWait($oIE,0,8000) $oForm = _IEFormGetCollection($oIE,1) $sHTML = _IEDocReadHTML ($oIE) $oUsername = _IEFormElementGetObjByname($oForm,"form_login_name") $oPassword = _IEFormElementGetObjByName($oForm,"form_login_password") $oLogin = _IEFormElementGetObjByName($oForm,"Login") _IEFormElementSetValue ($oUsername,$name) _IEFormElementSetValue ($oPassword,$password) _IEFormElementSetValue ($oLogin,$login) _IEFormElementRadioSelect($oForm, "world2", "form_world", 1, "byValue") Sleep(1000) _IEFormSubmit($oForm) _IeLoadWait($oIE,0,8000) Nothing happend with my Script except the Login-Popup. Could someone help me with my Problem? That would be very kind. Link to comment Share on other sites More sharing options...
wakillon Posted October 5, 2010 Share Posted October 5, 2010 Try this$name= "xyz" $password= "xyz" $oIE= _IECreate ($url) _IENavigate($oIE,"javascript:Login();") _IeLoadWait($oIE,0,8000) $oForm = _IEFormGetCollection($oIE,1) $oUsername = _IEFormElementGetObjByname($oForm,"form_login_name") _IEAction ( $oUsername, "focus" ) $hIE = _IEPropertyGet ( $oIE, "hwnd" ) ControlSend ( $hIE, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", $name ) $oPassword = _IEFormElementGetObjByName($oForm,"form_login_password") _IEAction ( $oPassword, "focus" ) $hIE = _IEPropertyGet ( $oIE, "hwnd" ) ControlSend ( $hIE, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", $password ) $oLogin = _IEFormElementGetObjByName($oForm,"Login") _IEAction ( $oLogin, "focus" ) $hIE = _IEPropertyGet ( $oIE, "hwnd" ) ControlSend ( $hIE, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", $login ) _IEFormElementRadioSelect($oForm, "world2", "form_world", 1, "byValue") Sleep(1000) _IEFormSubmit($oForm) _IeLoadWait($oIE,0,8000)but the url would be helpfull ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
666 Posted October 5, 2010 Author Share Posted October 5, 2010 Many tnx for your help. Ive seen, ive made a typo: Its form_welt and welt2. The URL is: $url = "http://www.farmparadies.de/" Ive tried your Code, but nothing happend. Link to comment Share on other sites More sharing options...
wakillon Posted October 5, 2010 Share Posted October 5, 2010 Arg ! there is a second window !I will see that... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
666 Posted October 5, 2010 Author Share Posted October 5, 2010 Yes, and i cant get Focus on it... Link to comment Share on other sites More sharing options...
wakillon Posted October 5, 2010 Share Posted October 5, 2010 (edited) I still have to take care of the login button, give me some time...#include <IE.au3> $url = "http://www.farmparadies.de/" $name= "xyz" $password= "xyz" $oIE= _IECreate ($url) _IENavigate ( $oIE, "javascript:Login();", 0 ) Sleep ( 1000 ) $oForm = _IEFormGetCollection($oIE,1) _IEFormElementRadioSelect($oForm, "welt2", "form_welt", 1, "byValue") $oUsername = _IEFormElementGetObjByname($oForm,"form_login_name") _IEFormElementSetValue ($oUsername,$name) $oPassword = _IEFormElementGetObjByName($oForm,"form_login_password") _IEFormElementSetValue ($oPassword,$password) Edited October 5, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
wakillon Posted October 5, 2010 Share Posted October 5, 2010 Try this : #include <IE.au3> $url = "http://www.farmparadies.de/" $name= "xyz" $password= "xyz" $oIE= _IECreate ( $url ) _IENavigate ( $oIE, "javascript:Login();", 0 ) Sleep ( 1000 ) $oForm = _IEFormGetCollection ( $oIE, 1 ) _IEFormElementRadioSelect ( $oForm, "welt2", "form_welt", 1, "byValue" ) $oUsername = _IEFormElementGetObjByname ( $oForm,"form_login_name" ) _IEFormElementSetValue ( $oUsername, $name ) $oPassword = _IEFormElementGetObjByName ( $oForm,"form_login_password" ) _IEFormElementSetValue ( $oPassword, $password ) Sleep ( 1000 ) $oElement = _IEFormElementGetObjByname ( $oForm, "login" ) _IEAction ( $oElement, "focus" ) _IEAction ( $oElement, "click" ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
666 Posted October 5, 2010 Author Share Posted October 5, 2010 (edited) It works! You are awesome I didnt know, that SLeep is so important. And looks like i need to learn something about "focus" Ive tried it for hours yesterday... (also ive tried it with packets, but dont worked too because if the cookie) Many many tnx. Edited October 5, 2010 by 666 Link to comment Share on other sites More sharing options...
wakillon Posted October 5, 2010 Share Posted October 5, 2010 It works!You are awesome I didnt know, that SLeep is so important.And looks like i need to learn something about "focus" Ive tried it for hours yesterday... (also ive tried it with packets, but dont worked too because if the cookie)Many many tnx.Thanks ! and good game ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts 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