| 1 |
NAME |
| 2 |
Test::WWW::Selenium - Test applications using Selenium Remote Control |
| 3 |
|
| 4 |
VERSION |
| 5 |
version 1.36 |
| 6 |
|
| 7 |
SYNOPSIS |
| 8 |
Test::WWW::Selenium is a subclass of WWW::Selenium that provides |
| 9 |
convenient testing functions. |
| 10 |
|
| 11 |
use Test::More tests => 5; |
| 12 |
use Test::WWW::Selenium; |
| 13 |
|
| 14 |
# Parameters are passed through to WWW::Selenium |
| 15 |
my $sel = Test::WWW::Selenium->new( host => "localhost", |
| 16 |
port => 4444, |
| 17 |
browser => "*firefox", |
| 18 |
browser_url => "http://www.google.com", |
| 19 |
default_names => 1, |
| 20 |
error_callback => sub { ... }, |
| 21 |
); |
| 22 |
|
| 23 |
# use special test wrappers around WWW::Selenium commands: |
| 24 |
$sel->open_ok("http://www.google.com", undef, "fetched G's site alright"); |
| 25 |
$sel->type_ok( "q", "hello world"); |
| 26 |
$sel->click_ok("btnG"); |
| 27 |
$sel->wait_for_page_to_load_ok(5000); |
| 28 |
$sel->title_like(qr/Google Search/); |
| 29 |
$sel->error_callback(sub {...}); |
| 30 |
|
| 31 |
DESCRIPTION |
| 32 |
This module is a WWW::Selenium subclass providing some methods useful |
| 33 |
for writing tests. For each Selenium command (open, click, type, ...) |
| 34 |
there is a corresponding "<command>_ok" method that checks the return |
| 35 |
value (open_ok, click_ok, type_ok). |
| 36 |
|
| 37 |
For each Selenium getter (get_title, ...) there are four autogenerated |
| 38 |
methods ("<getter>_is", "<getter>_isnt", "<getter>_like", |
| 39 |
"<getter>_unlike") to check the value of the attribute. |
| 40 |
|
| 41 |
By calling the constructor with "default_names" set to a true value your |
| 42 |
tests will be given a reasonable name should you choose not to provide |
| 43 |
one of your own. The test name should always be the third argument. |
| 44 |
|
| 45 |
NAME |
| 46 |
Test::WWW::Selenium - Test applications using Selenium Remote Control |
| 47 |
|
| 48 |
REQUIREMENTS |
| 49 |
To use this module, you need to have already downloaded and started the |
| 50 |
Selenium Server. (The Selenium Server is a Java application.) |
| 51 |
|
| 52 |
ADDITIONAL METHODS |
| 53 |
Test::WWW::Selenium also provides some other handy testing functions |
| 54 |
that wrap WWW::Selenium commands: |
| 55 |
|
| 56 |
get_location |
| 57 |
Returns the relative location of the current page. Works with _is, |
| 58 |
_like, ... methods. |
| 59 |
|
| 60 |
error_callback |
| 61 |
Sets the method to use when a corresponding selenium test is called |
| 62 |
and fails. For example if you call text_like(...) and it fails the |
| 63 |
sub defined in the error_callback will be called. This allows you to |
| 64 |
perform various tasks to obtain additional details that occured when |
| 65 |
obtianing the error. If this is set to undef then the callback will |
| 66 |
not be issued. |
| 67 |
|
| 68 |
$sel->debug() |
| 69 |
Starts an interactive shell to pass commands to Selenium. |
| 70 |
|
| 71 |
Commands are run against the selenium object, so you just need to |
| 72 |
type: |
| 73 |
|
| 74 |
eg: click("link=edit") |
| 75 |
|
| 76 |
AUTHORS |
| 77 |
* Maintained by: Matt Phillips <[email protected]>, Luke Closs |
| 78 |
<[email protected]> |
| 79 |
|
| 80 |
* Originally by Mattia Barbon <[email protected]> |
| 81 |
|
| 82 |
CONTRIBUTORS |
| 83 |
Dan Dascalescu |
| 84 |
|
| 85 |
Scott McWhirter |
| 86 |
|
| 87 |
COPYRIGHT AND LICENSE |
| 88 |
Copyright (c) 2011 Matt Phillips <[email protected]> |
| 89 |
|
| 90 |
Copyright (c) 2006 Luke Closs <[email protected]> |
| 91 |
|
| 92 |
Copyright (c) 2005, 2006 Mattia Barbon <[email protected]> |
| 93 |
|
| 94 |
This program is free software; you can redistribute it and/or modify it |
| 95 |
under the same terms as Perl itself. |
| 96 |
|