Luke Closs

NAME

WWW::Selenium::Utils::CGI - helper functions Selenium CGIs

SYNOPSIS

  # simple CGI script
  use WWW::Selenium::Utils::CGI qw(run);
  use CGI;
  print run( CGI->new() );

DESCRIPTION

This package contains useful functions for creating test scaffolding CGI scripts that Selenium can use. Users of this module will need to create their own cgi or mod_perl handlers that call these functions.

SUBROUTINES

These subs should be called by CGI or mod_perl wrappers. I feel this will provide the most generic interface that can be customized to any application. Sample CGI scripts are in scripts/ of this distribution. Indeed I use both CGI and mod_perl for various test projects.

run

run() will run an command passed in from as a CGI variable.

Note that this is NOT SAFE for general websites, as it allows ARBITRARY COMMANDS to be run. For testing purposes however, it is quite useful.

HTTP GET Parameters:

cmd

The command to execute. Note that you will need to properly encode commands in your selenium test cases, like this:

  /open /selenium/run.cgi?cmd=ls%20-l

cat

cat() will output the contents of a file.

Arguments:

basedir

The base directory when a relative path is used. Defaults to perl's install prefix.

HTTP GET Parameters:

file

The file to read. If the file does not begin with a '/', then the file will be relative to $Config{prefix} (where your perl is installed to).

raw

If this is false (the default), then the contents of the file will be surrownded in a pre block, to make the output look nicer in the browser.

state

Keeps any kind of key/value state. This can allow selenium to signal other processes or stare information. State is stored in a flat file in /tmp.

HTTP GET Parameters:

key (Mandatory)

A key to set or get.

value

If present, will be stored for the given key.

DIAGNOSTICS

None.

DEPENDENCIES

Uses CGI.

BUGS AND LIMITATIONS

There are no known bugs in this module. Please report problums to Luke Closs (cpan@5thplane.com). Patches are welcome.

AUTHOR

Luke Closs (cpan@5thplane.com)

LICENCE AND COPYRIGHT

Copyright (c) 2005 Luke Closs (cpan@5thplane.com). All rights reserved.

This module is free software; you can redstribute it and/or modify it under the same terms as Perl itself. See perlartistic.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.