njahncke Posted October 3, 2007 Posted October 3, 2007 Hey there everyone, Let me begin by apologizing if my etiquette is somewhat lackluster. I've searched through the forums for a similar issue, but haven't found anything close. My problem involves using the _IEAction method to submit a form that contains a user name not before seen on an IE 6 system, which leads to display of the "AutoComplete" dialog. Here's the code involved (obviously this won't work without an instantiated UI, it's just to demonstrate the procedure): $objOUserName = _IEGetObjByName($objMainBrowser,"txtUserName") $objOPassword = _IEGetObjByName($objMainBrowser,"txtPassword") $objOSubmit = _IEGetObjByName($objMainBrowser,"btnLogin") _IEAction($objOUserName,"focus") Send($caUserName) _IEAction($objOPassword,"focus") Send($caPassword) _IEAction($objOSubmit,"click") MsgBox(0,"...","Form submitted.") $winActive = WinWaitActive("AutoComplete","",1) If $winActive = 1 Then Send("n") _IELoadWait($objMainBrowser) For some reason, the MsgBox will never display. (Bear in mind the MsgBox is only for debugging purposes.) However, if I change _IEAction($objOSubmit,"click") to Send{"{TAB}") Send{"{SPACE}") it works just fine. Now... Does anyone have any idea why this might be? I can use the alternative method (am using, I should say); I'm just curious as to the reason for this behavior. Thanks in advance, anyone! Nathan
Matrix112 Posted October 3, 2007 Posted October 3, 2007 i´m not sure that i understand your problem right, but try to use _IEGetObjById if possible.
PsaltyDS Posted October 3, 2007 Posted October 3, 2007 Read the help file examples under _IEAction(): ; ******************************************************* ; 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) Got some browser side scripting on that page, do you...? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
njahncke Posted October 3, 2007 Author Posted October 3, 2007 Aw crap... Yeah, man I'm sorry. It was right there in front of me. I must have read that paragraph 3 times. Thanks for the reply all the same! Long day I guess... Btw, I swapped out the name references for IDs (in my first hasty glance through the code of the page I'm working with, I didn't see any ID attributes). Thanks for the advice.
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