|
| 1 | + |
| 2 | + |
| 3 | +# Overview |
| 4 | + |
| 5 | +*Test-WWW-Selenium* is a perl driver and test library for Selenium Remote |
| 6 | +Control (SRC). You will need to setup a Selenium Server that can launch |
| 7 | +browsers. |
| 8 | + |
| 9 | +*Selenium Remote Control (SRC)* is a test tool that allows you to write |
| 10 | +automated web application UI tests in any programming language against |
| 11 | +any HTTP website using any mainstream JavaScript-enabled browser. SRC |
| 12 | +provides a Selenium Server, which can automatically start/stop/control |
| 13 | +any supported browser. It works by using Selenium Core, a pure-HTML+JS |
| 14 | +library that performs automated tasks in JavaScript; the Selenium |
| 15 | +Server communicates directly with the browser using AJAX (XmlHttpRe- |
| 16 | +quest). |
| 17 | + |
| 18 | +This module sends commands directly to the Server using simple HTTP |
| 19 | +GET/POST requests. Using this module together with the Selenium |
| 20 | +Server, you can automatically control any supported browser. |
| 21 | + |
| 22 | +# Prereqs |
| 23 | + |
| 24 | +To use this module, you need to have already downloaded and started the |
| 25 | +Selenium Server. (The Selenium Server is a Java application.) |
| 26 | + |
| 27 | +The Selenium Server is available here: |
| 28 | + |
| 29 | + http://www.seleniumhq.org/download/ |
| 30 | + |
| 31 | +or on CPAN in the Alien-SeleniumRC package: |
| 32 | + |
| 33 | + http://search.cpan.org/dist/Alien-SeleniumRC |
| 34 | + |
| 35 | +# Installation |
| 36 | + |
| 37 | + perl Makefile.PL |
| 38 | + make |
| 39 | + make test |
| 40 | + make install |
| 41 | + |
| 42 | +# Usage |
| 43 | +Once installed, your test script will look something like this: |
| 44 | + |
| 45 | + #!/usr/bin/perl |
| 46 | + use strict; |
| 47 | + use warnings; |
| 48 | + use Test::More tests => 4; |
| 49 | + use Test::WWW::Selenium; |
| 50 | + |
| 51 | + my $sel = Test::WWW::Selenium->new( host => "localhost", # where selenium-server is running |
| 52 | + browser => "*firefox", # browser to server should launch |
| 53 | + browser_url => "http://your.site"); |
| 54 | + |
| 55 | + $sel->open("http://your.site"); |
| 56 | + $sel->title_is('Super Cool Mega Site!'); |
| 57 | + $sel->text_is('todays_awesomeness', '100'); |
| 58 | + $sel->text_like('status', qr/returned 42 results/); |
| 59 | + |
| 60 | +# Fineprint |
| 61 | + |
| 62 | +Copyright (c) 2006 Luke Closs <[email protected]>. |
| 63 | +Copyright (c) 2006 Dan Fabulitch <[email protected]>. |
| 64 | +Copyright (c) 2005, 2006 Mattia Barbon <[email protected]>. |
| 65 | + |
| 66 | +Other contributors: Dan Dascalescu, Scott McWhirter. |
| 67 | + |
| 68 | +lib/WWW/Selenium.pm comes from the Selenium-RC project, which releases |
| 69 | +it under the Apache License, Version 2.0. |
| 70 | + |
| 71 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 72 | + |
| 73 | +This package is free software; you can redistribute it and/or |
| 74 | +modify it under the same terms as Perl itself. |
0 commit comments