Jump to content

why the script freezes when I submit a form to IE


SimpleLiang
 Share

Recommended Posts

this is my first time trying IE UDFs, I'm login a ClearQuest site - software defect management system produced by IBM, I'm able to go through the login page and enter the main page, but my script doesn't run properly like below described:

a. the form submitted result is not printed out at the end of section1.

b. the setting of a query doesn't start in section2.

c. the IE has no further response too.

d. the script tray in the taskbar is still there showing it's running, but I don't see any progress it runs.

my whole script is here, and I replaced some private info with 'X', please help me analyze what is wrong, thanks.

;login int the ClearQuest

$obj_IE = _IECreate("http://192.168.252.XX/cqweb/login",1);get IE's object

$obj_FormLogin = _IEFormGetObjByName($obj_IE,"formLogin");get form's object

$obj_eleUserName = _IEFormElementGetObjByName($obj_FormLogin,"username");get input control's object

_IEFormElementSetValue($obj_eleUserName,"XXXXXXX");set usename value

$obj_elePassword = _IEFormElementGetObjByName($obj_FormLogin,"password")

_IEFormElementSetValue($obj_elePassword,"XXXX");set password value

$obj_selectDB = _IEFormElementGetObjByName($obj_FormLogin,"userDb")

_IEFormElementOptionselect($obj_selectDB,2,1,"byIndex",1);select proper value

$res_submit = _IEFormSubmit($obj_FormLogin,1);submit the form because the _IEAction fails to click the Login button

ConsoleWrite($res_submit&@CR&@error&@CR)

;section2, submit a defect query

$obj_formTopFrame = _IEFormGetObjByName($obj_IE,"formTopframe")

$obj_entityID = _IEFormElementGetObjByName($obj_formTopFrame,"entityId")

_IEFormElementSetValue($obj_entityID,"UDevC0014XXXX")

_IEFormSubmit($obj_formTopFrame,1)

;quit

_IEQuit($obj_IE)

Edited by SimpleLiang
Link to comment
Share on other sites

oh, when I change the 2nd parameter in the _IEFormSubmit from '1' to '0', the consolewrite executed, but error appears as well.

>>

--> IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch

-1

0

--> IE.au3 V2.4-0 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormSubmit, $_IEStatus_InvalidDataType

it seems, the getting object for form 'formTopFrame' failed, I'm sure this is the correct form name, is this because the $obj_IE doesn't work for current IE status, the URL and page has changed?

Link to comment
Share on other sites

Without knowing what the application is doing, it is impossible to say, but there are often very complex things going on with Javascript when you submit a form. The warnings you are getting are likely because the page has not yet loaded after the submit action.

First thing I would try would be to add _IELoadWait($oIE) after your form submit. If that is not successful, I would suggest you look at the second example for _IEAction that uses a keystroke SEND and follow that with the _IELoadWait.

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

Without knowing what the application is doing, it is impossible to say, but there are often very complex things going on with Javascript when you submit a form. The warnings you are getting are likely because the page has not yet loaded after the submit action.

First thing I would try would be to add _IELoadWait($oIE) after your form submit. If that is not successful, I would suggest you look at the second example for _IEAction that uses a keystroke SEND and follow that with the _IELoadWait.

Dale

thank you! I'll add a check after the form submit and see what would happen.

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