1Test::WWW::Selenium(3)User Contributed Perl DocumentationTest::WWW::Selenium(3)
2
3
4
6 Test::WWW::Selenium - Test applications using Selenium Remote Control
7
9 Test::WWW::Selenium is a subclass of WWW::Selenium that provides
10 convenient testing functions.
11
12 use Test::More tests => 5;
13 use Test::WWW::Selenium;
14
15 # Parameters are passed through to WWW::Selenium
16 my $sel = Test::WWW::Selenium->new( host => "localhost",
17 port => 4444,
18 browser => "*firefox",
19 browser_url => "http://www.google.com",
20 default_names => 1,
21 error_callback => sub { ... },
22 );
23
24 # use special test wrappers around WWW::Selenium commands:
25 $sel->open_ok("http://www.google.com", "fetched G's site alright");
26 $sel->type_ok( "q", "hello world");
27 $sel->click_ok("btnG");
28 $sel->wait_for_page_to_load_ok(5000);
29 $sel->title_like(qr/Google Search/);
30 $sel->error_callback(sub {...});
31
33 To use this module, you need to have already downloaded and started the
34 Selenium Server. (The Selenium Server is a Java application.)
35
37 This module is a WWW::Selenium subclass providing some methods useful
38 for writing tests. For each Selenium command (open, click, type, ...)
39 there is a corresponding "<command>_ok" method that checks the return
40 value (open_ok, click_ok, type_ok).
41
42 For each Selenium getter (get_title, ...) there are four autogenerated
43 methods ("<getter>_is", "<getter>_isnt", "<getter>_like",
44 "<getter>_unlike") to check the value of the attribute.
45
46 By calling the constructor with "default_names" set to a true value
47 your tests will be given a reasonable name should you choose not to
48 provide one of your own.
49
51 Test::WWW::Selenium also provides some other handy testing functions
52 that wrap WWW::Selenium commands:
53
54 get_location
55 Returns the relative location of the current page. Works with _is,
56 _like, ... methods.
57
58 error_callback
59 Sets the method to use when a corresponding selenium test is called
60 and fails. For example if you call text_like(...) and it fails the
61 sub defined in the error_callback will be called. This allows you
62 to perform various tasks to obtain additional details that occured
63 when obtianing the error. If this is set to undef then the callback
64 will not be issued.
65
67 Maintained by Luke Closs <lukec@cpan.org>
68
69 Originally by Mattia Barbon <mbarbon@cpan.org>
70
71 Other contributors: Dan Dascalescu, Scott McWhirter.
72
74 Copyright (c) 2006 Luke Closs <lukec@cpan.org> Copyright (c) 2005, 2006
75 Mattia Barbon <mbarbon@cpan.org>
76
77 This program is free software; you can redistribute it and/or modify it
78 under the same terms as Perl itself.
79
80
81
82perl v5.12.0 2010-04-02 Test::WWW::Selenium(3)