Jump to content
Sign in to follow this  

Handling IE9 file download, activex prompts

Recommended Posts

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>Posted Image</noscript>

Edited by jvish

Share this post

Link to post
Share on other sites


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(&quot;Save As&quot;, '', 'Edit1') == '') and (waited &lt; waitTime))
        if (ie9PopupHeight &lt; 70)
        ai.ControlClick(NATIONAL, &quot;&quot;, &quot;[Class:DirectUIHWND]&quot; , &quot;left&quot;, 1, buttonOffsetX, buttonOffsetY)
        sleep 0.1
        ai.ControlSend(NATIONAL, &quot;&quot;, &quot;[Class:DirectUIHWND]&quot;,&quot;{Down}&quot;)
        sleep 0.2
        ai.ControlSend(NATIONAL, &quot;&quot;, &quot;[Class:DirectUIHWND]&quot;,&quot;a&quot;)
        sleep 0.2

saving the file (no different from IE7 or IE8):

#fileName will look like 'someFile.txt'
    fileName=ai.ControlGetText(&quot;Save As&quot;, &quot;&quot;, &quot;Edit1&quot;)
    #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 = &quot;#{filepath}\\#{fileName}&quot;
    ai.ControlSend(&quot;Save As&quot;, &quot;&quot;, &quot;Edit1&quot;, fullFileName)
    ai.ControlClick(&quot;Save As&quot;, &quot;&quot;, &quot;&amp;Save&quot;, &quot;left&quot;)
    #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(&quot;Confirm Save As&quot;, &quot;&quot;, 1)
    ai.ControlClick(&quot;Confirm Save As&quot;, &quot;&quot;, &quot;&amp;Yes&quot;, &quot;left&quot;)
    $log.info(&quot;saving file #{filepath}\\#{fileName}&quot;)
    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 by jrwauto

Share this post

Link to post
Share on other sites


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.

Share this post

Link to post
Share on other sites

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

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...