Spiider11 Posted April 12, 2010 Posted April 12, 2010 Yes ... I know ... you will say read the remarks in the help file .. but they are no use. Let me explain what my problem is , i want to loggin multiple accounts on a webpage , but the _IEFormSubmit does not work as I would like it to . It does loggin the first account but then it gets stuck when I use _IENavigate to go to the login page , it does not navigate ! I used _IEAction too but with no results because it does not even login the first one. I have done same script for Firefox (FF.au3) and the _FFOpenUrl there works just fine with the form submit method . Can anyone help me with IE. Ohh here is the login code Func logare($user) Sleep(1000) $lg_form = _IEFormGetObjByName($oIE,"login") $lg_user = _IEFormElementGetObjByName($lg_form , "username") _IEFormElementSetValue ($lg_user, $user) $lg_pass = _IEFormElementGetObjByName($lg_form , "password") _IEFormElementSetValue ($lg_pass, "mypass") Sleep(500) _IEFormSubmit ($lg_form) ;$oSubmit = _IEFormElementGetObjByName($lg_form,"act1") ;_IEAction($oSubmit,"click") Sleep(1200) $oIE = _IEAttach($pl1,"HWND") Sleep(1000) EndFunc
Juvigy Posted April 12, 2010 Posted April 12, 2010 You said it works the first time. Can you post the IEnavigate part of your code(where it crashes)?
Spiider11 Posted April 12, 2010 Author Posted April 12, 2010 ok ... Here is the part where i call the functions : While $account <> "" And $i<1801 logare($account) Sleep(1000) status_check($homepage) Sleep(1000) delogare() Sleep(500) status_check($logpage) $i = $i+1 $account = FileReadLine($fusers,$i) $fpos = FileOpen(@ScriptDir&"\posIE.txt",10) FileWrite($fpos,$i) FileClose($fpos) Sleep(200) WEnd Here is the delogare() function that use _IENavigate Func delogare() _IENavigate($oIE,$logpage) EndFunc Here is the status_check() function that checks the status bar of IE for "Done" or "Done, but with errors on page" (basically a page is loaded check) Func status_check($page) $status = StatusbarGetText($page) While $status <> "Done" And $status <> "Done, but with errors on page." Sleep(100) $status = StatusbarGetText($page) WEnd EndFunc
Spiider11 Posted April 12, 2010 Author Posted April 12, 2010 hmm ... I think it has something to do with the _IEAttach part , but I tried to attach using the window title and got the same result ... any ideea? Thx in advance !
ssubirias3 Posted April 12, 2010 Posted April 12, 2010 ... any ideea?Hi, not sure what website you're attempting to work with. Recently I needed to automate a ColdFusion (.cfm) website. The logon form would accept the credentials using _IEFormElementSetValue(). And as you've described, I too wasn't able to get either _IEFormSubmit() or _IEAction() to submit the form correctly. So my workaround involved using the Send() function to emulate the manual entry of an enduser pressing ENTER. Granted Dale or some of the other au3 greats here would have the correct method of logging into this .cfm form, but it works for me and that's what matters. If anyone knows how to properly submit a ColdFusion I'd would appreciate the insight. And obviously the script sees the form correctly otherwise the credentials wouldn't be set in the UserID/Password fields. _IEFormElementSetValue($oUser, "EndUserID") _IEFormElementSetValue($oPass, "Som3_Str0ngP@ssworD!") Sleep(500) WinWait($WinTitle,"Done") Opt("SendKeyDelay", 100) Send("{TAB 3}") Send("{ENTER}") Opt("SendKeyDelay", 5) Cheers!!
Spiider11 Posted April 12, 2010 Author Posted April 12, 2010 (edited) thanks but I want to change my old script that simulates click on page and avoid using send because it's buggy , and my form does sumbit but after I login it does not navigate to the login page again ( i have to login multiple accounts ). The equivalent of this script in firefox works just fine!Can anyone help? Edited April 13, 2010 by Spiider11
Spiider11 Posted April 13, 2010 Author Posted April 13, 2010 anyone ... i've been stuck at this for 3 day
Juvigy Posted April 13, 2010 Posted April 13, 2010 The status check function seems useless - why do you need it? In the Scite console you should receive error msg - what is it?
Spiider11 Posted April 13, 2010 Author Posted April 13, 2010 (edited) no errors ... i think the scrips just doesn't navigate because $oIE changes on submit, and the attach function kind of messes up ! "logare\master.au3 - 0 error(s), 0 warning(s)" oh ... and the check function is an extra measure , i commented it and still the same result Edited April 13, 2010 by Spiider11
Spiider11 Posted April 13, 2010 Author Posted April 13, 2010 Ok , i found the problem , the submit method gets my script stuck , it works great with ControlClick instead of IEFormSubmit but i'm trying to get another method , I need some help with IEAction , for some reason it doesn't work
Spiider11 Posted April 13, 2010 Author Posted April 13, 2010 (edited) I used _IEFormImageClick($lg_form , "logbutt","name") and i still get logged just once and then it does not navigate What am I doing wrong? Edited April 13, 2010 by Spiider11
Spiider11 Posted April 13, 2010 Author Posted April 13, 2010 (edited) Bump ! This is stupid , i found the problem Here was the problem : _IEFormSubmit ($lg_form) And here is how I worked around it : _IEFormSubmit ($lg_form,0) Sleep(1200) _IELoadWait($homepage) The problem was that page load started after the loadwait was executed , and it got stuck ! I set the $f_wait of the function to 0 and used _IELoadWait with a sleep of 1.2 sec before Thanks to all who tried to help Edited April 13, 2010 by Spiider11
chappoian Posted April 13, 2010 Posted April 13, 2010 How come my script isn't working? It won't login. #include <IE.au3> $sUsername = "oDon" $sPassword = "uh0uxt9t" $sUrl = "http://www.bootleggers.us" $oIE = _IECreate ($sUrl) $oHWND = _IEPropertyGet($oIE, "hwnd") WinSetState ($oHWND, "", @SW_MAXIMIZE ) $oForm = _IEFormGetCollection ($oIE, 0) $oUsername = _IEFormElementGetObjByName ($oForm, "Username") $oPassword = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue ($oUsername, $sUsername) _IEFormElementSetValue ($oPassword, $sPassword) _IEFormSubmit ($oForm) _IELinkClickByText ($oIE, "crimes") The html code is: <tr> <td valign="top" width="216"><img src="http://img.bootleggers.us/game/login/new/bl.gif" width="216" height="138" alt="Login Image"></td> <td background="http://img.bootleggers.us/game/login/new/bc.gif" width="271" valign="top"> <table border="0" cellspacing="0" cellpadding="2" class="login" width="260"> <tr> <td align="center"> <input type="text" size="12" name="username" value="Username" onclick="clickClear(this, 'Username')" onblur="clickRecall(this, 'Username')"> </td> <td align="center"> <input type="password" size="12" name="password" value="Password" onfocus="clickClear(this, 'Password')" onclick="clickClear(this, 'Password')"> </td> <td align="center"> <input type="submit" value="Login"> </td> </tr> You may use my username and password for script testing purposes. When that works, I would like to actually commit a crime. I thought i will have to add the following to the code. But that also doesn't work. _IELinkClickByText ($oIE, "Beat up a Blind Man") _IEFormSubmit ($oForm) Sleep(12000) _IELinkClickByText ($oIE, "Beat up a Blind Man") _IEFormSubmit ($oForm)
Spiider11 Posted April 14, 2010 Author Posted April 14, 2010 (edited) this is a bot ... i think it's illegal on this forum... but i can tell you it has something to do with "onclick" from the page sourcecode the user and password fields will not get completed because of the actions they have attached to them . i know ... i had same problem , but mine was easier to fix. you could try _IEAction and use it with click Edited April 14, 2010 by Spiider11
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