WWW::Scripterを使用してjavascript/ajaxで記述されたページを取得しています。次のページへの「リンク」は、divタグです。タグを取得できますが、クリックしてアクセスする方法がわからないようです。次のページ..何か提案はありますか?
my $w = new WWW::Scripter;
$w->use_plugin('Ajax');
$w->get($c->website);
my $loop = 1;
my $page = 1;
while ($loop) {
my $te = HTML::TableExtract->new();
$content = $w->content();
$te->parse($content);
$table = $te->first_table_found;
$str .= Dumper $table;
$page += 1;
$loop = $self->next_page($w);
}
sub next_page {
my $self = shift;
my $w = shift;
$div = $w->document->getElementById('example_next');
if (defined $div) {
--I want to click on the div and move to the next page, suggestions?---
return 1;
} else {
return 0;
}
}
htmlコードの例...最初にデータを保持するテーブルがあります...
<table class="display" id="example">
<thead>
headers
</thead>
<tbody>---DATA---</tbody>
</table>
次に、「ページ」から「ページ」に移動するページ付けは、ページ付けをクリックするたびにデータが書き換えられます。
<div class="dataTables_paginate paging_two_button" id="example_paginate">
<div class="paginate_disabled_previous" title="Previous" id="example_previous"></div>
<div class="paginate_enabled_next" title="Next" id="example_next"></div>
</div>
これはすべてwww.datatables.netを使用しています