bobdole has asked for the wisdom of the Perl Monks concerning the following question:

First question I am trying log on to a secure site and after a successful login I get a dialog box titled "Security Information" asking if I want to display both secure and non secure items giving options of yes, no and more info.

Well I tried using WinClicker to click yes but I cant seem to get it to work, I have tried.

my $clicker = Win32::IEAutomation::WinClicker->new( warnings => 1) ;
$clicker->push_security_alert_yes();
and
$clicker->push_button_yes("Security Information");
and even
$clicker->push_confirm_button_ok();

With no success.

My second question is once I get to the page I am trying to find I try printing out a cell from a table and I keep getting "Can’t locate object method "rows" via package Win32::IEAutomation::Element" Same thing if I try using any other methods off my table object. Here is the code I am using:
@alltables = $ie->getFrame('name:', 'main')->getAllTables(); $my_row = $alltables[0]->rows(1); print $my_row->cellText;

Replies are listed 'Best First'.
Re: A couple of questions about Win32::IEAutomation
by syphilis (Archbishop) on Oct 18, 2007 at 23:37 UTC
      I think I can help you with the second question .. a colleague faced and fixed this issue :)
      The problem with using getAllTables is that it creates a new object for Win32::IEAutomation::Element ... whereas it should be creating an object for Win32::IEAutomation::Table as Table.pm has the subroutine for rows.
      To fix this.. all you need to do is make a small modification to the IEAutomation.pm file ... Open the file and search for the following subroutine :
      sub getAllTables{ my $self = shift; my $agent = $self->{agent}; my @links_array; my $links = $agent->Document->all->tags("table"); for (my $n = 0; $n < $links->length; $n++){ my $link_object = Win32::IEAutomation::Element->new(); $link_object->{element} = $links->item($n); $link_object->{parent} = $self; push (@links_array, $link_object); } return @links_array; }
      In the lines :
      my $link_object = Win32::IEAutomation::Element->new(); $link_object->{element} = $links->item($n);
      change 'element' to 'table' It should look like this :
      my $link_object = Win32::IEAutomation::Table->new(); $link_object->{table} = $links->item($n);
      NOTE: Please pay attention to the case.
      save this.. run ur script .. it should work like a charm .. if it doesn't ... send me a msg and i'll mail you the IEAutomation.pm file which is working.
      Sparkz
        The modification to IEAutomation.pm worked great, thanks alot!

        Still no luck on the "Security Information" dialog.
Re: A couple of questions about Win32::IEAutomation
by bobdole (Beadle) on Oct 19, 2007 at 19:34 UTC
    It looks like its not even reading the next line of code in the scipt until the "yes" is pushed on the dialog box.

    ... ... $ie->getButton('name:', "button1")->Click; ##submits form on previous +page print "made it here"; ## doesnt print until "yes" is clicked on securi +ty dialog box ... ...
    So its not even making it to the
    $clicker->push_security_alert_yes();
Re: A couple of questions about Win32::IEAutomation
by bobdole (Beadle) on Oct 19, 2007 at 19:45 UTC
    Ah found it, I just added the $nowait option to true $ie->getButton('name:', "button1")->Click(1);and it worked fine.
      Hi, I am speaking in context to ur solution to the 1st question. I too encountered a similar problem. Like if we navigate from Goolge to Gmail via the link given on Google. A popup called "Security Information" will surface. Now with this code "$ie->getButton('name:', "button1")->Click(1)" will become: $ie->getButton('name:', "Yes")->Click(1)/$ie->getButton('caption:', "Yes")->Click(1); but it is not working. Can u guide me? Thanks for any help. Regards Kash
        Have you had any luck with this. I'm having similiar problems. sometimes it works sometimes it does not. Below is my test: the first confirm works about 80% time, sometimes it does not. The second confirm never works. It never gets to made it hear4. sub test{ my $ie = Win32::IEAutomation->new(); $ie->gotoURL("www.samisite.com/test-csb2nf/id108.htm",1); # second argument says that don't wait for complete document loading and allow code to go to next line. print "made it here1\n"; my $clicker = Win32::IEAutomation::WinClicker->new(); print "made it here2\n"; $clicker->push_confirm_button_ok("Windows Internet Explorer"); print "made it here3\n"; $ie->WaitforDone; $ie->getButton('value:', "ORDINARY BUTTON")->Click(1); print "made it here4\n"; my $clicker = Win32::IEAutomation::WinClicker->new(); print "made it here5\n"; $clicker->push_confirm_button_ok("Windows Internet Explorer"); print "made it here6\n"; #$ie->WaitforDone; # we will wait here for complete loading of navigated site print "made it here7\n"; $ie->closeIE(); }