Balachander K Posted September 5, 2006 Posted September 5, 2006 (edited) Hi, I am having a problem after a click of a submit button in a IE page. $oForm = _IEFormGetObjByName($oCenterPanel,"publishMessageForm") If @error Then $vLogMsg = "Error occured $oForm = _IEFormGetObjByName($oCenterPanel,publishMessageForm). Error: " & @error & ", Function: _TigerLogin" MsgBox(4096, "Error!!", $vLogMsg) MsgBox(4096, "Error!", "Test is Stopped. Please Run the test after fixing the issue.") Exit EndIf $oSubmitButton = _IEFormElementGetObjByName($oForm,"submitButton",3) If @error Then $vLogMsg = "Error occured $oSubmitButton = _IEGetObjByName($oCenterPanel,submitButton,3). Error: " & @error & ", Function: _TigerLogin" MsgBox(4096, "Error!!", $vLogMsg) MsgBox(4096, "Error!", "Test is Stopped. Please Run the test after fixing the issue.") Exit EndIf MsgBox(0,"BeforeClick",_IELoadWaitTimeout ()) _IEAction($oSubmitButton,"click");SCRIPT HANGS HERE!!!! If @error Then $vLogMsg = "Error occured _IEAction($oSubmitButton,click). Error: " & @error & ", Function: _TigerLogin" MsgBox(4096, "Error!!", $vLogMsg) MsgBox(4096, "Error!", "Test is Stopped. Please Run the test after fixing the issue.") Exit EndIf MsgBox(0,"AfterClick","AfterClick") Sleep(1000) WinActive("Microsoft Internet Explorer","Please confirm you w") ControlClick("Microsoft Internet Explorer","Please confirm you w","Button1") Sleep(1000) MsgBox(0,"AfterSubmit","AfterSubmit") Here the problems is i am clicking on the submit button and after that i get a popup message box with ok and cancel...here the autoit hangs. AutoIT hangs after the click of the submit button itself...i am not getting the after click message box i have put...although i am getting the before click messagebox... i have tried to submit the form directly but the values are not getting set as it calls a sequence of javascripts. $oSubmitButton.click is having the same effect as _IEAction... Is it anything to do with the IE window getting disabled because of the modal dialog box? Am i missing something basic here? i broke my head with this for hours...somebody please help...popup.bmp Edited September 5, 2006 by Balachander K
Balachander K Posted September 5, 2006 Author Posted September 5, 2006 <td> <input type="submit" name="submitButton" value="Submit" onclick="java script:return submitPublish('submit');"> <input type="submit" name="cancelButton" value="Cancel" onclick="java script:return submitPublish('cancel');"> </td> ok its of type submit. why its hanging when clicking on button of type 'submit'? -Thanks Bala
Moderators SmOke_N Posted September 5, 2006 Moderators Posted September 5, 2006 I'm guilty of not using _IE.au3... but is $oSubmitButton defined anywhere? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
DaleHohm Posted September 5, 2006 Posted September 5, 2006 The modal dialog pauses browser execution and your script is waiting a return status from the click event. You can use a similar w/around as this one for input type=file elements: ; ******************************************************* ; Example 4 - Set the value of an INPUT TYPE=FILE element ; (security restrictions prevent using _IEFormElementSetValue) ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example("form") $oForm = _IEFormGetObjByName($oIE, "ExampleForm") $oInputFile = _IEFormElementGetObjByName($oForm, "fileExample") ; Assign input focus to the field and then send the text string _IEAction($oInputFile, "focus") Send("C:\myfile.txt") focus on your input button and then send Enter or Space. Your script then gets control back and you can use standard AutoIt functions to dismiss the dialog. 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
Balachander K Posted September 7, 2006 Author Posted September 7, 2006 Thanks Dale... Now its working... Regards, Bala
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