Created
September 29, 2012 04:52
-
-
Save t-kashima/3803216 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl; | |
use strict; | |
use warnings; | |
use lib './lib'; | |
use Wight; | |
use utf8; | |
binmode STDOUT, ':utf8'; | |
my $baseurl = 'http://google.co.jp'; | |
my $keyword = 'YAPC ASIA'; | |
my $wight = Wight->new; | |
$wight->visit($baseurl); | |
$wight->find('//input[@name="q"]')->set($keyword); | |
$wight->find('//input[@type="submit"]')->click(); | |
print $wight->evaluate('document.title') . "\n"; | |
foreach ($wight->find('//h3[@class="r"]/a')) { | |
print ' * ', $_->text . "\n"; | |
} | |
my $next_param = $wight->find('//table[@id="nav"]//td[@class="b"]/a')->attribute('href'); | |
$wight->visit($baseurl . '/' . $next_param); | |
$wight->render('yapc.png'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment