01 #!/usr/local/bin/perl -w 02 use strict; 03 use WWW::Scripter; 04 use Sysadm::Install qw(:all); 05 use HTML::TreeBuilder::XPath; 06 07 my $w = WWW::Scripter->new(); 08 $w->use_plugin('Ajax'); 09 10 my $pw = slurp "pw.txt"; 11 chomp $pw; 12 $w->credentials( "root", $pw ); 13 $w->get('http://192.168.0.1'); 14 15 $w->wait_for_timers( max_wait => 1 ); 16 17 my $tree= HTML::TreeBuilder::XPath->new(); 18 $tree->parse( $w->content() ); 19 my $uptime = 20 $tree->findvalue( 21 '/html/body//tr[@id="uptime"]/' . 22 'td[@class="content"]'); 23 24 print "uptime: $uptime\n";