Hello,

  I found two good references for using Win32::OLE as a replacement
  for WWW::Mechanize on Windows (the first is by Jan Dubois):

      
http://library.n0i.net/programming/perl/pe-rlmonth/issue3/ole_controls.html 
      http://www.perl.com/lpt/a/916

  In my application, the current page being processed has 
  the javascript lines:
   
      <img src="/foobar/imgs/image.gif" width="10" height="10">
      <input name="ButtonFoo" type="button" value="Start" 
      onclick="self.location='/foo/bar/foobar.cgi?do_it=1'; return false;">

  My present work-around for clicking the above button are the lines:

      $file = 'https://secure.foo.com/foo/bar/foobar.cgi?do_it=1';
      $ie_object->Navigate($file);
 
  Question:  Is there a better way to click the javascript button
             and if so, what?

  Thanks,

  --Suresh

  PS:  Here's code fragment I am currently using to fill-out 
       fields in a form and to click buttons in a form:  

       sub fill_form_field
       {
           my ($ie_object, $name, $value) = @_;
           my $ie_document    = $ie_object->{Document};
           my $forms          = $ie_document->forms;
       
           foreach my $form (in $forms) 
           {
                print "\tLooking at form: ", $form->name(), " for fill-in field 
$name\n";
                if(defined $form->elements($name))
                {
                    $form->elements($name)->{value} = $value;
                    last;
                }
                print "\t\tbut did not find it\n";
           }
       }
       
       sub click_form_button
       {
           my ($ie_object, $name) = @_;
           my $ie_document        = $ie_object->Document;
           my $forms              = $ie_document->forms;
       
           foreach my $form (in $forms) 
           {
                print "\tLooking at form: ", $form->name(), " for clickable 
element $name\n";
                if(defined $form->elements($name))
                {
                     $form->elements($name)->click;
                     last;
                }
                print "\t\tbut did not find it\n";
           }
       }
       

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to