http://qs1969.pair.com?node_id=871126

mmittiga17 has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I am using Win32::IEAutomation to navigate a website, click website buttons. This works well as LWP or Mech would not work for this site. Problem is when I choose to download file the "Download File" window appears and I can not get the Save button to fire. Here is my code, thoughts suggestions?

use Win32::GuiTest qw(FindWindowLike GetWindowText SetForegroundWindow + SendKeys); $Win32::GuiTest::debug = 0; # Set to "1" to enable verbose mode my @windows = FindWindowLike(undef, "^File Download","#32770"); SetForegroundWindow($windows[0]); print "$windows[0]>\t'", GetWindowText($windows[0]), "'\n"; PushButton("^\&Save",1); sleep(2); SendKeys("%S"); while(FindWindowLike(0, "^Download Complete")) { PushButton("Close",2); }

Replies are listed 'Best First'.
Re: Win32::GuiTest for File download
by BrowserUk (Patriarch) on Nov 12, 2010 at 19:29 UTC

    Impossible to know without seeing the website, but my guess is that the "window" you are trying to control is not a windows native window, but rather some kind of Javascript/CSS 'overlay'. Ie. Instead of the window being made of of Windows native controls, which is required for GUItest to be able to navigate to the correct control by inspecting the window text of the button, that window is just a picture drawn on top the browser window contents.

    If so, you won't be able to interact with it using window titles or button labels as they will only exist inside the javascript. The only way GUItest would be able to automate that is by sending a mouse click directly to the appropriate position on the screen.

    I do hope for your sake that it's not one of those dratted CSS/Javascript 'floating widgets' that are popping up all over.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      It is one of those windows popup windows spawned by IE with three buttons. Open Save and Cancle. Win32::GuiTest i thought is supposed to handle windows apps like Excel and what not.

        If it is an IE dialog, then GUItest should handle it without problems.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.