Home

charpi edited this page Jul 24, 2011 · 23 revisions
Clone this wiki locally

Selenium is a well known web unittest framework, it allows you to test your web site inside several browsers.
Selenium-RC is an extension which allow you to run your tests remotely and from your favorite language.

When I started to be interested by selenium, no erlang client library was avaiable.
After a quick look at the protocol between the server and the ‘library’, I don’t see any reasons that make the erlang binding impossible to write so I decided to write erl_selenium.

In order to start using erl_selenium, you can download the last source package at http://github.com/charpi/erl_selenium/downloads or visit the public git repository.

If you are using erl_selenium, I’ll be glad to have your feedback. Feel free to send a mail at selenium@charpi.net

Status

Last download version supports:

  1. OTP R14
  2. Selenium server 2.1.0 (provided in the package)

Installation

From source

  1. Download the archive file.
  2. Unzip it
  3. Enter in the directory
  4. Compile the project with rake (Please ensure to update the file erlang_config.rb.)
More information about how to build erlang with rake can be found at erl_rake To validate that the package is working as expected
  1. rake start_server
  2. rake tests
  3. rake stop_server

Usage

The package is extremely simple to use and don’t have extra dependency.
All requests are made with the standard OTP http client. If you want to use it for load testing, you might encounter some limitation due to httpc.

Simple

test () ->
    Session = selenium :start (?HOST,?PORT, ?BROWSER, ?URL),
    Start_url = "http://charpi.net",
    Command = open,
    selenium: cmd (Session, Command, [Start_url]),
    selenium: stop (Session).

Selenium API

test () ->
    Session = selenium :start (?HOST,?PORT, ?BROWSER, ?URL),
    Start_url = "http://charpi.net",
    selenium_api: open (Session, Start_url),
    selenium: stop (Session).

Selenium Session

test () ->
    Session = selenium :launch_session (?HOST,?PORT, ?BROWSER, ?URL),
    Start_url = "http://charpi.net",
    Session: open (Start_url),
    Session: stop_session ().