CC: | sprout [...] cpan.org |
Subject: | JE::Object::Proxy error when using WWW::Scripter |
Date: | Tue, 25 Sep 2012 18:00:33 -0500 |
To: | bug-WWW-Scripter [...] rt.cpan.org |
From: | Nathan Chaney <nathan [...] chaneylaw.com> |
I'm trying to use WWW::Scripter with the Ajax plugin to scrape the information from a webpage. It is my understanding that the get method retrieves the HTML, executes the AJAX code, and makes the response available through the content method.
Here's my code:
#!/usr/bin/perl -w
use strict;
use WWW::Scripter;
###### Scripting declarations #############
my $w = new WWW::Scripter;
$w->use_plugin('Ajax');
####### Redirect output of curl to WHILE loop; reads USPTO web page line-by-line
my $url='http://tsdr.uspto.gov/#caseNumber=85304498&caseType=SERIAL_NO&searchType=statusSearch';
$w->get($url);
print $w->content;
The resulting content will be parsed by Perl (this is test code — there are lots of these pages I'm trying to automatically parse). I've already written the Perl code to parse the page, and the site recently switched from server-side execution to an AJAX-based implementation. The AJAX code appears to automatically populate the page when the variables are set in the URL indicated above. That is, no form submission is required in a browser when the URL above is used.
This code returns the following error during the get method:
Error: Can't locate object method "style" via package "JE::Object::Proxy" at /Library/Perl/5.10.0/CSS/DOM.pm line 155.
TypeError: The object's 'widget' property (undefined) is not a function at http://tsdr.uspto.gov/js/lib/jquery.multiselect.js, line 647.
Then, the code prints the HTML as it appears before the AJAX code populates the appropriate <div> tag. It returns the content but not, as the WWW::Scripter documentation indicates, after it has been modified by scripts.
It is not a function of enabling fetch_images, because I tried that.
Is this a bug? Or am I missing a step required to evaluate the AJAX code on the page?
Thanks,
Nathan
--
Nathan Chaney
Registered Patent Attorney | www.chaneylaw.com
(870) 246-0600 telephone | (866) 734-0971 facsimile