chenxu Posted August 18, 2007 Share Posted August 18, 2007 (edited) I obtain the Internet button object, the submit button, and then, I use the function _IEAction to send a click on the button. This sequence works fine. the web page I submit will popup a dialog box to tell me that the submit action is done. Here is the problem, I found that the macro is paused at _IEAction until I answer the dialog box. How can I go on to run the macro after I send a click to the submit button? Thanks very much Edited August 18, 2007 by chenxu Link to comment Share on other sites More sharing options...
Generator Posted August 18, 2007 Share Posted August 18, 2007 Take a look at _IELoadWaitTimeOut() Link to comment Share on other sites More sharing options...
DaleHohm Posted August 18, 2007 Share Posted August 18, 2007 Take a look at _IELoadWaitTimeOut()There are two scenarios that result in an apparent "hang" like this... 1) when the page does not yet appear to IE.au3 that it is completely loaded and _IELoadWait has control and is waiting for your page to signal it is done... in this case, _IELoadWaitTimeOut can be used. 2) when Javascript or event processing on the browser-side prevent control from returning to your script until some browser-side action completes -- in this case, an alert box of some sort. I have to answer this question here in the forums once every few weeks, so I need to figure out a way to document it where people can find it. For now, I put a new example in helpfile in the recent beta that shows you how to work around the issue. This is not a bug, it is normal - however complicated. Here are the helpfile examples for _IEAction, please see Example 2: ; ******************************************************* ; Example 1 - Open a browser with the "form" example, get a reference ; to the submit button by name and "click" it. This technique ; of submitting forms is useful because many forms rely on Javascript ; code and "onclick" events on their submit button making _IEFormSubmit() ; not perform as expected ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("form") $oSubmit = _IEGetObjByName ($oIE, "submitExample") _IEAction ($oSubmit, "click") _IELoadWait ($oIE) ; ******************************************************* ; Example 2 - Same as Example 1, except instead of using click, give the element focus ; and then use ControlSend to send Enter. Use this technique when the ; browser-side scripting associated with a click action prevents control ; from being automatically returned to your code. ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("form") $oSubmit = _IEGetObjByName ($oIE, "submitExample") $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction ($oSubmit, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") ; Wait for Alert window, then click on OK WinWait("Windows Internet Explorer", "ExampleFormSubmitted") ControlClick("Windows Internet Explorer", "ExampleFormSubmitted", "[CLASS:Button; TEXT:OK; Instance:1;]") _IELoadWait ($oIE) Dale Palestinian 1 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 More sharing options...
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