jvish Posted April 23, 2011 Share Posted April 23, 2011 (edited) I am trying to automate IE9 prompts for File Downlod, ActiveX download and other "Notification Bar" objects.Unlike IE7/IE8 where the notification bars are Win32 - IE9 has this of type DIRECTUIHWND. And I am not able to get the info of buttons, text etc from it.Please check the attached picture. I need to capture the text from it & be able to click buttons on the yellow bar at the bottom of the browser.Please let me know how this can be handled with AutoIT.<script src='http://img130.imageshack.us/shareable/?i=ie9filedownloadwindow.jpg&p=tl' type='text/javascript'></script><noscript></noscript> Edited April 23, 2011 by jvish Link to comment Share on other sites More sharing options...
jrwauto Posted September 15, 2011 Share Posted September 15, 2011 (edited) IE9.0 Windows 7 I have been having issues with this while using ruby's watir-webdriver. Here's my (crappy, but consistently working) autoIt solution (in ruby, you'll have to do some translation of course): Basically, the popupHeight can differ (short or tall, see attached images), but it can be detected. This script uses the position and an X,Y click, which I hate doing, but as I said, it works pretty consistently. It click the down arrow next to the Save button, sends the Down Key to make it show the options of Save, Save As, and Save and Run, then sends 'a' to indicate Save As. clicking Save As: while((ai.ControlGetText("Save As", '', 'Edit1') == '') and (waited < waitTime)) ie9PopupHeight=ai.ControlGetPosHeight(NATIONAL,'',"[Class:DirectUIHWND]") ie9PopupWidth=ai.ControlGetPosWidth(NATIONAL,'',"[Class:DirectUIHWND]") if (ie9PopupHeight < 70) buttonOffsetX=ie9PopupWidth-122 buttonOffsetY=27 else buttonOffsetX=ie9PopupWidth-100 buttonOffsetY=56 end ai.ControlClick(NATIONAL, "", "[Class:DirectUIHWND]" , "left", 1, buttonOffsetX, buttonOffsetY) sleep 0.1 ai.ControlSend(NATIONAL, "", "[Class:DirectUIHWND]","{Down}") sleep 0.2 ai.ControlSend(NATIONAL, "", "[Class:DirectUIHWND]","a") sleep 0.2 waited+=0.2 end saving the file (no different from IE7 or IE8): #fileName will look like 'someFile.txt' fileName=ai.ControlGetText("Save As", "", "Edit1") #fullFileName will look like '\someDir\someFile.txt' #originally it was normal like 'c:\someDir\someFile.txt' but for some BS reason the ControlSend would send 'c;\...' instead of 'c:\...' fullFileName = "#{filepath}\\#{fileName}" ai.ControlSend("Save As", "", "Edit1", fullFileName) ai.ControlClick("Save As", "", "&Save", "left") #hopefully this will not happen too much, but in case we're re-saving the same file, this 'Confirm Save As' part will kick in: ai.WinWait("Confirm Save As", "", 1) ai.ControlClick("Confirm Save As", "", "&Yes", "left") $log.info("saving file #{filepath}\\#{fileName}") sleep 1 #wait until the file is written to the disk. yes, we have to wait. refresh #we do this because sometimes the browser will act weird (not reach a READY state) after a download Edited September 15, 2011 by jrwauto Link to comment Share on other sites More sharing options...
icu Posted October 18, 2011 Share Posted October 18, 2011 @jrwauto Can you please 'translate' your ruby code into AutoIt code or write a UDF please? I don't know Ruby at all and so the solution is unworkable for me and possibly others. Link to comment Share on other sites More sharing options...
icu Posted October 20, 2011 Share Posted October 20, 2011 @jvish: I think I've found a work around. Basically you need to get the pixel co-ordinates using Au3Info.exe and the code the mouse movements and clicks with the likes of ControlClick (). I've got a similar problem to you except mine has to do with the IE9 'View Downloads - Windows Internet Explorer' pop-up box. I've only ever used AutoIt for IE automation or for small GUI apps so the Control stuff is all new. I've nearly got something working last night however sometimes it breaks with bad co-ordinates depending on the file name length of the previous download and the new position of my 'View Downloads' box. You might not have this issue since you need to click within IE9. I would suggest maximizing IE to get reliable pixel co-ordinates and when running your script to do the same, that way your co-ordinates are less likely to break like mine. 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