how to get table name using Win32::IEAutomation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ketanm
    New Member
    • Aug 2010
    • 8

    how to get table name using Win32::IEAutomation

    Hi all,
    I have to get all table and it's row and column entry.
    let say this is the url http://hg.sagemath.org and it has
    four table name,Descriptio n,Contact,Last change and each table has some content.i have to get all name's content.
    how i can do this.i am using http://search.cpan.org/~prashant/Win...EAutomation.pm
    i tried below code but i got Can't call method "rows" on an undefined value this error.

    Code:
    use Win32::IEAutomation;
           use Win32::IEAutomation::Table; 
           use Win32::IEAutomation::Element;
          use Win32::IEAutomation::WinClicker; 
            
            # Creating new instance of Internet Explorer
            my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1);
            
            # Site navigation 
           $ie->gotoURL('http://hg.sagemath.org');  
            $ie->WaitforDone;
           $mytable= $ie->getTable("class:","Name");
           
           $my_row = $mytable->rows(2);



    Please anyone help me on this topic.
    Thanks,
    Last edited by numberwhun; Aug 19 '10, 12:10 AM. Reason: Please Use CODE TAGS!
  • ketanm
    New Member
    • Aug 2010
    • 8

    #2
    hi

    Hi ,
    i tried with below code and it works but i am not getting individual table's content.


    code.........

    Code:
    use LWP;
           use Win32::IEAutomation;
           use Win32::IEAutomation::Table; 
           #use Win32::IEAutomation::Element;
           use Win32::IEAutomation::WinClicker; 
          use HTML::TokeParser;
          use HTML::TableExtract;
           use HTML::Parser; 
            use LWP::Simple;
            # Creating new instance of Internet Explorer
            my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1);
            
            # Site navigation 
           $ie->gotoURL('http://hg.sagemath.org');  
            $ie->WaitforDone;
           
           #print  $ie->Content();
           
           
         my $page = get('http://hg.sagemath.org') ||
     	die "Could not load URL\n";
     	
     	
     	 my $p = HTML::TokeParser->new(\$page) ||
     	die "Parse error\n";
     	
     	
           
           #$p = HTML::TokeParser->new("$ie->Content()");
            while (my $token = $p->get_tag("<td><a ")) {
                 #my $url = $token->[1]{href} || "-";
                 my $text = $p->get_trimmed_text("/</a></td>");
                 print " $text\n ";
      }
    Last edited by numberwhun; Aug 19 '10, 12:12 AM. Reason: Please Use CODE TAGS!

    Comment

    • numberwhun
      Recognized Expert Moderator Specialist
      • May 2007
      • 3467

      #3
      @ketanm Indenting your code does not add the proper code tags. You need to use them whenever posting code in the forums. Please read the FAQ for the proper way to ask questions.

      Regards,

      Jeff

      Comment

      Working...