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

Hello monks,
I have a script that navigates page to download a file. I am prompted with a window to download the file as usual. I would like to mechanize this last part using Win32::GuiTest.
Here is my example script:
use WWW::Mechanize::Firefox; use Win32::GuiTest qw ( SendKeys SetForegroundWindow FindWindowLike MouseClick ); my $mech = WWW::Mechanize::Firefox->new(); $mech->get($downloadpage); #At this point I'm prompted to download the file.. Win32::GuiTest::FindWindowLike('Opening dailyfiles_txt.tar'); Win32::GuiTest::SendKeys("{ENTER}");
The 'Opening..' windows just hangs there. I just want it to somehow select 'Ok'. Any tips or meta-hints on what I'm doing wrong is greatly appreciated!
PerlSufi

Replies are listed 'Best First'.
Re: Downloading with Win32::GuiTest
by Corion (Patriarch) on Jul 01, 2013 at 17:51 UTC

    I use the "Always save this file to that folder" option of Firefox. I never got around to automating the download dialogs.

      Thanks, Corion. I may end up doing that.. I was just hoping there was a way around it so the script could be run on a machine that didn't have that set up
Re: Downloading with Win32::GuiTest
by dasgar (Priest) on Jul 01, 2013 at 18:39 UTC

    You might consider adding in a delay after starting the download before you try to find the pop up using Win32::GuiTest. I'm just wondering if it's possible that you're looking for the pop up window before it comes into existence.

      Thanks dasgar. I told it to sleep for a bit and it still did not select the window. For now I am just using the 'save automatically' idea as a workaround