Selenium is a well known web unittest framework, it allows you to test your web site in several browsers.
For more information about Seleniuim look here.
One interesting add-on to Selenium is a test server and a remote access library.
Those two components allow you to write web unit tests in your favorite language. Well it's not totally the truth because no erlang binding exists.
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 archive 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
Version history
- 20080913
- Changes
- selenium_api and selenium_session now export function with 'erlang style' name. Compatibility with 20080907 is broken.
- Bug Fix
- R12 specific APIs introduced with 20080907 are removed
- Changes
- 20080907
- Changes
- Commands are sent using POST requests.
- UTF8 support
- Support commands which return arrays. (use selenium:cmd_array/4)
- New module selenium_api which exports all selenium commands see Usages
- New module selenium_session which reduces the duplication of 'Session' writing tests
- Api doc generation $TOP/lib/selenium_remote/doc/selenium_api.html
- Known problems
- Don't compile with OTP R11 due to the use of string:join/2. This will be solve in newer version
- Modules selenium_api and selenium_session exports function with camelCase names (just as in Java). In next version, exports will have erlang style name, so compatibility will be broken if you use those modules
- Changes
- 20080829
- Changes
- OTP R12 support
- Support Selenium server 1.0-beta
- Include Selenium server 1.0-beta
- Limitations
- Commas in result string aren't correctly interpreted.
- Only support 'GET' requests so you can reach the max length of an URI if you are typing long texts.
- Changes
- 20080622
- Repackaging of the 'really first version'
- OTP R11 support
- Include Selenium server 0.92
Installation
- Download the archive file.
- Unzip it
- cd <dir>
- make ERLDIR=<path_to_your_erlang_installation>
To see how tests run:
- make start_server
- make test
- make stop_server
Usage
Simple
test () ->
Session = selenium :start (?HOST,?PORT, ?BROWSER, ?URL),
Start_url = "http://charpi.net",
selenium: cmd (Session, open, [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 ().