NAME

WWW::Selenium - Perl Client for the Selenium Remote Control test tool


SYNOPSIS

    use WWW::Selenium;
    
    my $sel = WWW::Selenium->new( host => "localhost", 
                                      port => 4444, 
                                      browser => "*iexplore", 
                                      browser_url => "http://www.google.com",
                                    );
    
    $sel->start;
    $sel->open "http://www.google.com";
    $sel->type "q", "hello world";
    $sel->click "btnG";
    $sel->wait_for_page_to_load 5000;
    print $sel->get_title;
    $sel->stop;


DESCRIPTION

Selenium Remote Control (SRC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. SRC provides a Selenium Server, which can automatically start/stop/control any supported browser. It works by using Selenium Core, a pure-HTML+JS library that performs automated tasks in JavaScript; the Selenium Server communicates directly with the browser using AJAX (XmlHttpRequest).

http://www.openqa.org/selenium-rc/

This module sends commands directly to the Server using simple HTTP GET/POST requests. Using this module together with the Selenium Server, you can automatically control any supported browser.

To use this module, you need to have already downloaded and started the Selenium Server. (The Selenium Server is a Java application.)

Element Locators

Element Locators tell Selenium which HTML element a command refers to. The format of a locator is: locatorType=argument We support the following strategies for locating elements:

identifier=id

Select the element with the specified @id attribute. If no match is found, select the first element whose @name attribute is id. (This is normally the default; see below.)

id=id

Select the element with the specified @id attribute.

name=name

Select the first element with the specified @name attribute.

The name may optionally be followed by one or more element-filters, separated from the name by whitespace. If the filterType is not specified, value is assumed.

dom=javascriptExpression

Find an element using JavaScript traversal of the HTML Document Object Model. DOM locators must begin with ``document.''.

xpath=xpathExpression

Locate an element using an XPath expression.

link=textPattern

Select the link (anchor) element which contains text matching the specified pattern.

Without an explicit locator prefix, Selenium uses the following default strategies:

Element Filters

Element filters can be used with a locator to refine a list of candidate elements. They are currently used only in the 'name' element-locator. Filters look much like locators, ie. filterType=argumentSupported element-filters are: value=valuePattern

Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.index=index

Selects a single element based on its position in the list (offset from zero). =head3 String-match Patterns

Various Pattern syntaxes are available for matching string values:

glob:pattern

Match a string against a ``glob'' (aka ``wildmat'') pattern. ``Glob'' is a kind of limited regular-expression syntax typically used in command-line shells. In a glob pattern, ``*'' represents any sequence of characters, and ``?'' represents any single character. Glob patterns match against the entire string.

regexp:regexp

Match a string using a regular-expression. The full power of JavaScript regular-expressions is available.

exact:string

Match a string exactly, verbatim, without any of that fancy wildcard stuff.

If no pattern prefix is specified, Selenium assumes that it's a ``glob'' pattern.

METHODS

The following methods are available:

$sel = WWW::Selenium->new( %args )

Constructs a new WWW::Selenium object, specifying a Selenium Server host/port, a command to launch the browser, and a starting URL for the browser.

Options:


SEE ALSO

For more information about Selenium Remote Control, visit the website at http://www.openqa.org/selenium-rc/.


BUGS

The Selenium Remote Control JIRA issue tracking system is available online at http://jira.openqa.org/browse/SRC.


AUTHOR

Maintained by Dan Fabulich <dfabulich@warpmail.net>


LICENSE

Copyright (c) 2006 ThoughtWorks, Inc

Licensed under the Apache License, Version 2.0 (the ``License''); you may not use this file except in compliance with the License. You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an ``AS IS'' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.