p459mj49slp Posted November 28, 2008 Posted November 28, 2008 Hi,I am trying to use AutoIt to login to the following webpage by filling and submitting the form;https://portalcp.joymax.com/member/joymax_main_login.jmxThe problem is that when AutoIt submits the form, it justs refreshes, I think it may be because the structure of the form on the webpage is different, however I don't know how to get around this problem. The code I have is as follows;CODE#include <IE.au3>Dim $oIE$oIE = _IECreate("https://portalcp.joymax.com/member/joymax_main_login.jmx",0,1)_IELoadWait($oIE)$oForm = _IEFormGetObjByName($oIE,"loginFrm")$oUser = _IEFormElementGetObjByName($oForm,"userId")$oPass = _IEFormElementGetObjByName($oForm,"userPwd")_IEFormElementSetValue($oUser,"testuser")_IEFormElementSetValue($oPass,"testpass")_IELoadWait($oIE)Sleep(1000)_IEFormSubmit($oForm)ExitI would appreciate it if somebody could show me my mistake or show me a different way to submit this form and login.Regards.
Valuater Posted November 28, 2008 Posted November 28, 2008 This works... #include <IE.au3> Dim $oIE $oIE = _IECreate("https://portalcp.joymax.com/member/joymax_main_login.jmx",0,1) _IELoadWait($oIE) $oForm = _IEFormGetObjByName($oIE,"loginFrm") $oUser = _IEFormElementGetObjByName($oForm,"userId") $oPass = _IEFormElementGetObjByName($oForm,"userPwd") _IEFormElementSetValue($oUser,"testuser") _IEFormElementSetValue($oPass,"testpass") ;_IELoadWait($oIE); this does not belong here, no action to wait for Sleep(1000) $pic_txt = "https://img3.joymax.com/property/joymax/joymax_portal_2/icon_img/but_img/login.jpg" _IEFormImageClick($oForm, $pic_txt) 8)
Valuater Posted November 28, 2008 Posted November 28, 2008 Last Seen: Today, 09:23 AM Sometimes ya just wonder if these guys ever get the script you made for them!!!...??? 8)
Valuater Posted November 28, 2008 Posted November 28, 2008 Thank you very much Valuater. Welcome... and Welcome to the Autoit Forums!... BTW good first post, because you tried... 8)
p459mj49slp Posted November 28, 2008 Author Posted November 28, 2008 Welcome... and Welcome to the Autoit Forums!... BTW good first post, because you tried... 8)Thanks... one more question with the code above, anything I write AFTER the _IEFormImageClick() will not be executed because it stalls after it. Try adding MsgBox(0,"Hi","Hi). What am i doing wrong?
p459mj49slp Posted November 29, 2008 Author Posted November 29, 2008 Anybody? Any help would be greatly appreciated.
Valuater Posted November 29, 2008 Posted November 29, 2008 the page is busy with "stuff" moving around so the final loadwait does not get executed #include <IE.au3> Dim $oIE $oIE = _IECreate("https://portalcp.joymax.com/member/joymax_main_login.jmx",0,1) _IELoadWait($oIE) $oForm = _IEFormGetObjByName($oIE,"loginFrm") $oUser = _IEFormElementGetObjByName($oForm,"userId") $oPass = _IEFormElementGetObjByName($oForm,"userPwd") _IEFormElementSetValue($oUser,"testuser") _IEFormElementSetValue($oPass,"testpass") ;_IELoadWait($oIE); this does not belong here, no action to wait for Sleep(1000) $pic_txt = "https://img3.joymax.com/property/joymax/joymax_portal_2/icon_img/but_img/login.jpg" _IEFormImageClick($oForm, $pic_txt, "src", 0, 0) ; The last parameter is to return immediately and not use _IELoadsWait() MsgBox(0,0,0) 8)
p459mj49slp Posted November 29, 2008 Author Posted November 29, 2008 (edited) Thanks!!! You're a star. Using the code above everything is fine, except I have another problem, when I get to the next page, internet explorer shows a msgbox saying invalid password. I don't know how I can detect that. Any ideas? Edited November 29, 2008 by kenan557
Valuater Posted November 29, 2008 Posted November 29, 2008 Thanks!!! You're a star.Using the code above everything is fine, except I have another problem, when I get to the next page, internet explorer shows a msgbox saying invalid password. I don't know how I can detect that. Any ideas?Now how come your password/info doesn't work?... are you trying to get into others accounts???8)
p459mj49slp Posted November 29, 2008 Author Posted November 29, 2008 Now how come your password/info doesn't work?... are you trying to get into others accounts???8)No. I need to put remote login on 25 PCs at the internet cafe and therefore need to be able to return to the user that his id/pw is incorrect if it is.
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