Jump to content

Recommended Posts

Posted

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.jmx

The 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)

Exit

I would appreciate it if somebody could show me my mistake or show me a different way to submit this form and login.

Regards.

Posted

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)

NEWHeader1.png

Posted

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?

Posted

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)

NEWHeader1.png

Posted (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 by kenan557
Posted

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)

NEWHeader1.png

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...