By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,660 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,660 IT Pros & Developers. It's quick & easy.

how to get table name using Win32::IEAutomation

P: 8
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,Description,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.

Expand|Select|Wrap|Line Numbers
  1. use Win32::IEAutomation;
  2.        use Win32::IEAutomation::Table; 
  3.        use Win32::IEAutomation::Element;
  4.       use Win32::IEAutomation::WinClicker; 
  5.  
  6.         # Creating new instance of Internet Explorer
  7.         my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1);
  8.  
  9.         # Site navigation 
  10.        $ie->gotoURL('http://hg.sagemath.org');  
  11.         $ie->WaitforDone;
  12.        $mytable= $ie->getTable("class:","Name");
  13.  
  14.        $my_row = $mytable->rows(2);



Please anyone help me on this topic.
Thanks,
Aug 14 '10 #1
Share this Question
Share on Google+
2 Replies


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


code.........

Expand|Select|Wrap|Line Numbers
  1. use LWP;
  2.        use Win32::IEAutomation;
  3.        use Win32::IEAutomation::Table; 
  4.        #use Win32::IEAutomation::Element;
  5.        use Win32::IEAutomation::WinClicker; 
  6.       use HTML::TokeParser;
  7.       use HTML::TableExtract;
  8.        use HTML::Parser; 
  9.         use LWP::Simple;
  10.         # Creating new instance of Internet Explorer
  11.         my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1);
  12.  
  13.         # Site navigation 
  14.        $ie->gotoURL('http://hg.sagemath.org');  
  15.         $ie->WaitforDone;
  16.  
  17.        #print  $ie->Content();
  18.  
  19.  
  20.      my $page = get('http://hg.sagemath.org') ||
  21.      die "Could not load URL\n";
  22.  
  23.  
  24.       my $p = HTML::TokeParser->new(\$page) ||
  25.      die "Parse error\n";
  26.  
  27.  
  28.  
  29.        #$p = HTML::TokeParser->new("$ie->Content()");
  30.         while (my $token = $p->get_tag("<td><a ")) {
  31.              #my $url = $token->[1]{href} || "-";
  32.              my $text = $p->get_trimmed_text("/</a></td>");
  33.              print " $text\n ";
  34.   }
Aug 15 '10 #2

numberwhun
Expert Mod 2.5K+
P: 3,503
@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
Aug 19 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.