I've played with Win32::GuiTest a bit, but not SAM or this specfic purpose.
Sometimes I'll have difficulties sending keys to the proper window.
To fix that, I'd often use GuiTest's FindWindowLike to get  the window filehandle.
Then I have used either SetFocus to that window, or sometimes ShowWindow.
 
Or ...
Occasionally, there is a lag in the window appearing, so I'd put a couple seconds worth of sleep()
(WaitWindow might do that job, too.) before sending the keys.
 
If this helps, use it. But no guarantees.
Ed Zarger
----- Original Message -----
Sent: Wednesday, November 09, 2005 3:39 PM
Subject: Can't download file with Win32::GuiTest

I am using Win32::SAM and Win32::GuiTest to navigate through a Website and export a file.

I want to save a file and can’t get past the ‘File Download’ window.

My code is as follows-

 

Use strict;

Use warnings;

use Win32::OLE qw(EVENTS);

use Win32::SAM;

use Win32::GuiTest qw(SendKeys);

 

      StartIE();

      Navigate("http://www.somsite.com");

     

      SetEditBox("txtName","Matthew");

      SetEditBox("txtPassword","password");

 

      ClickFormButton("m_btnLogin2");

 

      ClickLink("My Page");

      ClickLink("Saved Searches");

      ClickAHyperlinkID("m_dlSavedSearches__ctl5_m_btnFull","","",1);

      ClickFormButtonByIndex(9);

      ClickFormButtonByIndex(0);

     

 

      SendKeys("s",5000);

      SendKeys("s",5000);

      SendKeys("{ENTER}");

 

"ClickFormButtonByIndex(0);" starts a file download and "SendKeys("s",5000);" sends the s key to the open,save or cancel dialog box. I can't get any keys to send to the 'File Download' dialog box and have no idea why not.

 

The last lines of output before the program exits are -

___________snip________________

Event triggered: 'DocumentComplete'

Here are the number of frames: 0

Here is $noframes: 0

DocumentComplete doccounter = 0

WaitForBusy = 0

ReadyState = 4

Calling QuitMessageLoop

pushing arg 1 http://www.somesite.com?c=AAEAAAD*****AQAAAAAAAA

ARAQAAAEYAAAAGAgAAAAQxNzMzBgMAAAABMQYEAAAAATEGBQAAAAExBgYAAAACMTYNAgYHAAAAATgNBw

YIAAAABjQyMDE2MQ0NBgkAAAADMTAwBgoAAAABMA0FBgsAAAAFYsKHfloGDAAAAAMxNTgGDQAAAAExBg

4AAAAYUkUvTUFYIENpdHlTaWRlIExpc3RpbmdzDR4L

WaitForDocumentComplete->Finished Blocking

Event triggered: 'BeforeNavigate2'

BeforeNavigate2 doccounter = 1

ReadyState = 4

Event triggered: 'StatusTextChange'

Inside WaitForDocumentComplete

Cleaning @IEObjects

Blocking with MessageLoop

WaitForDocumentComplete->Finished Blocking

Event triggered: 'DownloadBegin'

Event triggered: 'ProgressChange'

_______end_____________

Any help would be appreciated.

Thank You,

Matthew Ryan


_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to