Perl Oasis 2011 - HtmlUnit.pdf - The Lack Thereof
Perl Oasis 2011 - HtmlUnit.pdf - The Lack Thereof
Perl Oasis 2011 - HtmlUnit.pdf - The Lack Thereof
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
WWW::<strong>HtmlUnit</strong><br />
<strong>Perl</strong> Interface to the Java library<br />
Brock Wilcox (awwaiid@thelackthereof.org)<br />
<strong>Perl</strong> <strong>Oasis</strong> <strong>2011</strong><br />
This talk brought to you by liquidation.com!
Scrape
Test
Dumb Terminals
Smart Terminals
Javascript
Multiple Windows<br />
[i]Frames<br />
AJAX
<strong>HtmlUnit</strong>
Headless<br />
Javascript<br />
Multi-Window<br />
Frames<br />
Dialogs<br />
…. Java
Inline::Java
WWW::<strong>HtmlUnit</strong>
WWW::<strong>HtmlUnit</strong>::Sweet
INSTALL
apt-get install default-jdk<br />
JAVA_HOME=/usr/lib/jvm/default-java \<br />
cpanm WWW::<strong>HtmlUnit</strong>
use WWW::<strong>HtmlUnit</strong>::Sweet;
my $browser = WWW::<strong>HtmlUnit</strong>::Sweet->new(<br />
url => 'http://google.com/'<br />
);<br />
print $browser->asXml;
Full Browser
Full DOM
$rows =<br />
$browser->getByXPath('//tr');
$rows =<br />
$browser<br />
->getByXPath('//tr')<br />
->toArray;
Documentation
Example
Cursor Focus<br />
Keypresses<br />
DHTML<br />
AJAX<br />
Confirmation Dialog
Get it on CPAN
<strong>The</strong> End