Monastery, I need help with Mechanize firefox module.I am trying to download a usage file and I have automated to the point where I get a prompt for Opening "file" dialog with two radio buttons open (selected) and save file. I am trying to execute a java-script that will select the save file radio button and then the ok button, but I don't seem to find out how to do that. Any ideas on how to execute the javascript from within my code? Currently my code looks like this:

my $agent = WWW::Mechanize::Firefox->new(autoclose => 0); $agent->get($url); # check if page has a login cached page if ($cached) { $agent->form_number('1'); $agent->field(j_username=>$username); $agent->field(j_password=>$password); $agent->submit(); die unless ($agent->success); } else { #Now we retrieve the download page for downloading usage records. my $usagepage="$url$usagelink"; $agent->get($usagepage); $agent->form_name($usageform); $agent->field("#dateFrom",$datefrom); $agent->field("#dateTo",$dateto); #this now brings out the download prompt dialog box # and requires action $agent->eval_in_page('doExport();); # Need to now obtain file somehow... die unless ($agent->success);

Any help or direction is greatly appreciated.


In reply to JavaScript POP up in Firefox for open with and save file dialog by Dnice

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.