diff options
author | Struan Donald <struan@exo.org.uk> | 2011-05-16 17:29:11 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-05-16 17:29:11 +0100 |
commit | debac67821da719976f2d7805d21d9f0b8092a33 (patch) | |
tree | a507cc444f75b210c586c79ebb618d4969f43f39 | |
parent | 44cdd0e57a323c7d1faf2e1fe4ad3bb473f70c92 (diff) |
method to extract problem banner
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 0965ff49c..ecca3f7a8 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -312,7 +312,7 @@ sub extract_problem_meta { $title = $mech->extract_problem_title; -Returns the problem title from a problem report page +Returns the problem title from a problem report page. =cut @@ -327,6 +327,26 @@ sub extract_problem_title { return $result->{title}; } + +=head2 extract_problem_banner + + $banner = $mech->extract_problem_banner; + +Returns the problem title from a problem report page. Returns a hashref with id and text. + +=cut + +sub extract_problem_banner { + my $mech = shift; + + my $result = scraper { + process 'div#side > p', id => '@id', text => 'TEXT'; + } + ->scrape( $mech->response ); + + return $result; +} + =head2 visible_form_values $hashref = $mech->visible_form_values( ); |