+ my $link;
+ if (exists $s->{next_selector}) {
+ ($link) = map {$_->URI()->abs()}
+ $m->find_all_links(@{$s->{next_selector}});
+ } elsif (exists $s->{next_selector_tree}) {
+ $link = $m->tree->look_down(@{$s->{next_selector_tree}});
+ if (not defined $link) {
+ $m->tree->dump;
+ }
+ die "Unable to find next link" unless defined $link;
+ $link = $link->attr('href');
+ }