mmittiga17 has asked for the wisdom of the Perl Monks concerning the following question:
I'am use WWW::Mechanize::Firefox to access a java website to generate reports for download. After I choose the report I want I have to enter date parameters for which I want the data for. To do this I click on a link that opens a popup window where you select and fill in values. When the popup opens I do not know how to access it and it times out on me with the following error: "command timed-out at C:/Perl/site/lib/MozRepl/Client.pm line 186" Using applescript I am able to via safari on mac.
do JavaScript "document.aspnetForm.ctl00$ContentPlaceHolder2$selectDay +.value = \"" & pday & "\";" in document 1 of window id win2 do JavaScript "document.aspnetForm.ctl00$ContentPlaceHolder2$selectMon +th.value = \"" & mnth & "\";" in document 1 of window id win2 #delay 5 do JavaScript "document.getElementById('ctl00_ContentPlaceHolder2_btnS +ubmit2').click()" in document 1 of window id win2
Is there a way to do same thing with perl and firefox? What would cause the timeout issue?
Here is my code so far:use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new( visible => 1, autoclose => 0, +); $mech->get('https://www.XXX.com/XXX/aspx/XXXLogin.aspx'); sleep(2); $mech->field(username => 'XXX'); sleep 1; # give the page more time $mech->click_button( name => 'btn_LoginSubmit' ); $mech->field(answer1 => 'XXX'); $mech->field(answer2 => 'XXX'); $mech->click_button( name => 'btnKBA_Submit' ); sleep(1); $mech->field(password => 'XXX'); $mech->click_button( name => 'btnPwd_Submit' ); sleep(1); $mech->follow_link( text_regex => qr/Investment Detail/i ); sleep(1); #---Launch Popup windo---# $mech->follow_link( text_regex => qr/Filter/i );
If I can not access the popup then this is not going to work and I am not going to waste any more time with this. so any suggestions and ideas are welcomed. Thank you all in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Mechanize::Firefox popup window help
by Corion (Patriarch) on May 13, 2012 at 17:45 UTC | |
by mmittiga17 (Scribe) on May 16, 2012 at 15:09 UTC | |
by bbrown25 (Initiate) on May 08, 2014 at 19:11 UTC |