...
##
use WWW::Scripter;
# ...
$url = "http://www.foo.com/stats/xyz/"; # my target site.
$w = new WWW::Scripter;
$w->use_plugin('Ajax');
$content = $w->get($url);
# @div_elems = $w->document->getElementsByTagName('div');
@anchor_elems = $w->document->getElementsByTagName('a');
foreach $anchor_elem (@anchor_elems) {
$click_attr = $anchor_elem->getAttribute('onclick');
if ( ($click_attr =~ m/displayAllPayPosition/) || ($click_attr =~ m/displayAllEntrants/) ) {
# We're finding this attr and getting here.
$click_result = $anchor_elem->click(); # Only supported for HTML5?
print "CLICK RESULT: ", $click_result, "\n"; # Issue: shows nothing.
# So I also tried:
$response_info = $anchor_elem->trigger_event('onclick');
print "RESP INFO: ", $response_info, "\n";
$resp_content = $response_info->content;
print "RESP CONTENT: ", $resp_content, "\n";
# TODO: or could we use $click_resp = $w->click($button_name); ??
#This would return an HTTP::Response object.. then use $click_resp->content
# to get at the content. But what is our $button_name? we're not in a form. Dont
# think we can use it. Other options??
}
}
exit;