|
This post originated from an RSS feed registered with Perl Buzz
by Andy Lester.
|
Original Post: Test::WWW::Mechanize adds scraping functions
Feed Title: Perlbuzz
Feed URL: http://perlbuzz.com/atom.xml
Feed Description: What's happening in the world of Perl programming, including Perl 5, Perl 6, the CPAN and Parrot?
|
Latest Perl Buzz Posts
Latest Perl Buzz Posts by Andy Lester
Latest Posts From Perlbuzz
|
|
The new 1.40 release of Test::WWW::Mechanize adds functions to help scrape text from your HTML as you test it. This should make things much easier for your integration test of your web apps.
For example, if you want to make sure that this shows up:
<h1>My awesome page!</h1>
then you can add an id attribute to the <h1>
<h1 id="pagetitle">My awesome page!</h1>
and your test can check for it:
$mech->scraped_id_is( 'pagetitle', 'My Awesome Page!' );
Two other functions are added to help in your text extraction: ->scrape_text_by_id() and ->scrape_text_by_attr().
Will these functions help your testing? Do you have other methods that you use to aid testing? As always, I welcome your feedback.
Read: Test::WWW::Mechanize adds scraping functions