Hi All,

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.


In reply to WWW::Mechanize::Firefox popup window help by mmittiga17

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.