Skip to content

Instantly share code, notes, and snippets.

@t-kashima
Created September 29, 2012 04:52
Show Gist options
  • Save t-kashima/3803216 to your computer and use it in GitHub Desktop.
Save t-kashima/3803216 to your computer and use it in GitHub Desktop.
#!/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