Jump to content

IE.au3 V2.1-0 (was IE.au3 T2.0-6 pre-release)


DaleHohm
 Share

Recommended Posts

Hey dale, i'm running into an issue where i can fill out a form, but the _IEFormSubmit() is not submitting... i've tried playing with all of the possible parameters to try to delay execution (just in case) up to even including a 2 second sleep after an _IELoadWait(). There is no error output in the console, and as i said the form is populated just never submitted. There are no frames, or anything else that strikes me as odd, so i was just wondering if you can think of something that could be causing my issue. i'm attaching the source because it is not a public site in addition to my code and the console output. I know how to manually force the submit by navigating the page with the fields in the address, but trying to avoid sending my login information plain text if i run this on one of our other machines. Any ideas?

;this is the portion of my code that deals with the login on the form
#include<ie.au3>
$x = 3
$myex = ObjGet("","excel.Application")
$critilink = _IECreate("----")
$loginform = _IEFormGetObjByName($critilink,"form1")
$un = _IEFormElementGetObjByName($loginform,"loginUser")
$pw = _IEFormElementGetObjByName($loginform,"loginPw")
_IEFormElementSetValue($un,"username",1)
_IEFormElementSetValue($pw,"password",1)
_IELoadWait($critilink)
Sleep(2000)
_IEFormSubmit($loginform)
Exit

console output

>"C:\Program Files\AutoIt3\SciTe\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "U:\deprecated and sources\criticomchecker.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+> Starting AutoIt3Wrapper v.1.7.5

>Running AU3Check (1.54.6.0) params: from:C:\Program Files\AutoIt3

+>AU3Check ended.rc:0

>Running:(3.2.2.0):C:\Program Files\AutoIt3\autoit3.exe "U:\deprecated and sources\criticomchecker.au3"

+>AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 5.256

page.html

Link to comment
Share on other sites

ok, i've got my workaround, but IEFormSubmit is still not working for me. instead of using that, i'm using

ControlSend("Login - Microsoft Internet Explorer","","Internet Explorer_Server1","{ENTER}") which just sends the enter to the window without

having to have the browser visible or anything. ie.au3 is still the best, but i'm not having any luck with this one form. the formsubmit is returning -1, and the @error is staying at 0, but nothing happens. the line above submits, but i was kind of hoping i was doing something incorrectly.

Link to comment
Share on other sites

  • Moderators

@cameronsdad - I'm not exactly sure what causes this, but here is a quick work around.

#include <IE.au3>
$x = 3
$myex = ObjGet("", "excel.Application")
$critilink = _IECreate("----")
$loginform = _IEFormGetObjByName($critilink, "form1")
$un = _IEFormElementGetObjByName($loginform, "loginUser")
$pw = _IEFormElementGetObjByName($loginform, "loginPw")
$sb = _IEFormElementGetObjByName($loginform, "Submit")
_IEFormElementSetValue($un, "username", 1)
_IEFormElementSetValue($pw, "password", 1)
_IEAction($sb, "click")
_IELoadWait($critilink)
Exit
Link to comment
Share on other sites

I'm guessing that there is more to the picture than what is in the HTML you included.

It is possible that there is some Javascript on the page that is adding an onclick event for the submit button or some other similar technique. It is also possible that the form really does submit, but since the "value=Login" does not get passed unless the submit button is actually clicked it could be comming back to rest immediately on the same page making it look like nothing happened.

In any case, the workarounds you and Bob came up with should be the answer.

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

@cameronsdad - I'm not exactly sure what causes this, but here is a quick work around.

#include <IE.au3>
$x = 3
$myex = ObjGet("", "excel.Application")
$critilink = _IECreate("----")
$loginform = _IEFormGetObjByName($critilink, "form1")
$un = _IEFormElementGetObjByName($loginform, "loginUser")
$pw = _IEFormElementGetObjByName($loginform, "loginPw")
$sb = _IEFormElementGetObjByName($loginform, "Submit")
_IEFormElementSetValue($un, "username", 1)
_IEFormElementSetValue($pw, "password", 1)
_IEAction($sb, "click")
_IELoadWait($critilink)
Exit
nice, i didn't even think of that one, i've not had to use _IEAction before. i don't think i'll implement it yours, just because mine is already working and i've moved on to other parts of the script. I'll definitely be looking at the actions in _IEAction again though, it's been a while.
Link to comment
Share on other sites

I'm guessing that there is more to the picture than what is in the HTML you included.

It is possible that there is some Javascript on the page that is adding an onclick event for the submit button or some other similar technique. It is also possible that the form really does submit, but since the "value=Login" does not get passed unless the submit button is actually clicked it could be comming back to rest immediately on the same page making it look like nothing happened.

In any case, the workarounds you and Bob came up with should be the answer.

Dale

the source is the html, but the actual login processing is done serverside, it's all .asp. i like bob's better than my own, just because it makes use of the functions in ie.au3 rather than sending a key, but i just read that one after moving on to other issues. thanks for the response, and thanks again for helping us beat IE into submission.

Link to comment
Share on other sites

BTW, you'll find this documented in the helpfile -- _IEFormSubmit remarks describe the issue and point to an example in the section on _IEAction for a workaround.

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

  • 2 months later...

Case $s_action = "refresh"
    $o_object.document.execCommand ("Refresh")
    _IELoadWait($o_object)
    SetError($_IEStatus_Success)
    Return 1
Case $s_action = "back"
    If Not __IEIsObjType($o_object, "documentContainer") Then
        __IEErrorNotify("Error", "_IEAction", "$_IEStatus_InvalidObjectType")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
    $o_object.GoBack ()
    SetError($_IEStatus_Success)
    Return 1
Case $s_action = "forward"
    If Not __IEIsObjType($o_object, "documentContainer") Then
        __IEErrorNotify("Error", "_IEAction", "$_IEStatus_InvalidObjectType")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
    $o_object.GoForward ()
    SetError($_IEStatus_Success)
    Return 1
Case $s_action = "home"
    If Not __IEIsObjType($o_object, "documentContainer") Then
        __IEErrorNotify("Error", "_IEAction", "$_IEStatus_InvalidObjectType")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
    $o_object.GoHome ()
    SetError($_IEStatus_Success)
    Return 1
DaleHohm, would it be possible to set a timeout for the _IEAction()s above? i see that 'refresh' has an _IELoadWait($o_object), but the others i don't know.

my script dies when the site is being slow and the page doesn't immediately respond

thanks

Edited by user52
Link to comment
Share on other sites

DaleHohm, would it be possible to set a timeout for the _IEAction()s above? i see that 'refresh' has an _IELoadWait($o_object), but the others i don't know.

my script dies when the site is being slow and the page doesn't immediately respond

thanks

something like this?

$TIMEOUT = 5000 ;5 second timeout

Case $s_action = "refresh"
    $o_object.document.execCommand ("Refresh")
    For $i = 0 To 5
        _IELoadWait($o_object, 0, $TIMEOUT / 5)
    Next
    SetError($_IEStatus_Success)
    Return 1
Link to comment
Share on other sites

  • 1 month later...

Yes. Use file:// in place of http://

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

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