Jump to content

_IEFormSubmit strange effect


faustf
 Share

Recommended Posts

hi guy

i have  site and  i want  do automatic login

i write  this  code

Global $oIE = _IECreate("http://www.computergross.it/portal/viewHome.do",0,1,1,1)

Local $oForm = _IEFormGetObjByName($oIE, "loginForm")
Local $username = _IEFormElementGetObjByName($oForm, "userId")
_IEFormElementSetValue($username , "user")
Local $pass = _IEFormElementGetObjByName($oForm, "pwd")
_IEFormElementSetValue($pass , "password")
;sleep(1000)
_IEFormSubmit($oForm,0)

when i insert  a  real  username  and  password in this script  , and  run it . when execute _IEFormSubmit($oForm,0) i have  ,  in answer   error  login ,  but  if   i comment  this ; _IEFormSubmit($oForm,0)   and  after inputn user e password  clik with arrow mouse   , i  go  correctly , why ??

someone  have  idea?? thankz  so much

Link to comment
Share on other sites

If it set the values in the username and password correctly you can try to use _IEAction to click on the  "enter" or "submit" button (don't dare to check the website in the office, thats why i dont like working in big companies )

Edit: I mean using _IEAction insted of _IEFormSubmit, but I read that _IEAction could be problematic if you have some fresher version of IE, but not mandatorily

Edited by SorryButImaNewbie
Link to comment
Share on other sites

Many modern forms don't use the Submit action, but rather JavaScript tied to another element that may look look a Submit button - which is why the Click works.  Another possibility is that the page may be looking for the "value" of the Submit button that is sent with the form data when a submit button is clicked, but not on a Form Submit action.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

If it doesnt give errors you must have #include <IE.au3> , so the other thing I can think of is that the "submit" is not the name of the object? (I tested and it seems to me that the internet explorer actions aren't case sensitives, but could it be that one of the variables arent declared? Like in your first post you use $oIE and now $oie.)

Edited by SorryButImaNewbie
Link to comment
Share on other sites

#include <IE.au3>

Global $oIE = _IECreate("http://www.computergross.it/portal/viewHome.do",0,1,1,1)
If Not IsObj($oIE) Then Exit MsgBox(0, "Error", "$oIE")
Local $oForm = _IEFormGetObjByName($oIE, "loginForm")
If Not IsObj($oForm) Then Exit MsgBox(0, "Error", "$oForm")
Local $username = _IEFormElementGetObjByName($oForm, "userId")
If Not IsObj($username) Then Exit MsgBox(0, "Error", "$username")
_IEFormElementSetValue($username , "user")
Local $pass = _IEFormElementGetObjByName($oForm, "pwd")
If Not IsObj($pass) Then Exit MsgBox(0, "Error", "$pass")
_IEFormElementSetValue($pass , "password")
$Button = _IEFormElementGetObjByName($oForm, "login-submit")
If Not IsObj($Button) Then Exit MsgBox(0, "Error", "$Button")
_IEAction($Button, "click")

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...