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