Selenium : Web Testing in Scheme

_Selenium : Web Testing in Scheme_

By  Noel Welsh (noel at untyped dot com)

This manual documents Schematics version 1.0
Time-stamp: <2007-05-10 11:59:31 noel>

Keywords: _selenium_, _test_, _testing_, _web testing_,


Selenium ( is a tool for testing web applications, the core of which is a Javascript library that controls a web browser.  With the Selenium Remote Control you can control a web browser from code.  This colection provides Scheme bindings to the commands the Selenium Remote Control understands. 


This little example shows how to use Selenium to search on Google.

To start, you need to download the Selenium RC.  I STRONGLY
suggest you download the latest Selenium RC nightly build,
at the time of writing 0.9.1-SNAPSHOT.  You can get releases

Start the Selenium RC

  java -jar selenium-server.jar

Now start up Dr/MzScheme and run the following:

  (require (planet "" ("untyped" "selenium.plt" 1)))

   (selenium-server "localhost" 4444 "*firefox" "")
   (open "")
   (type "q" "Untyped")
   (click "btnG")
   (wait-for-page-to-load 500)
   (check string=?
          "Untyped - Google Search"))

After a period of time you should see a Firefox browser come
up, visit the Google home page, and search for Untyped.

Selenium API

> exn:selenium?
> exn:selenium:bad-response?

Predicates that can be used to test from exceptions thrown by the Selenium library.

> (selenium-server host port browser target)
selenium-server : string string string string -> selenium-server

Create a connection to the Selenium Remote Control

> (with-selenium server expr ...)

This macro executes the given expressions in a dynamic context where the current Selenium server is server.

The remainder of the commands are as documented in the online Selenium API