Selenium Webdriver for Erlang Quick Start
Selenium is the industry standard for automated testing of web applications. Together with Webdriver, a ‘remote control’ API for all major browsers, it enables you to create robust integration test for the browser.
It’s trivial to get started with the following steps:
Step 1: Add webdrv to the rebar.config of your project
rebar.config in your favorite editor, and make sure webdrv is listed as dependency. I use a fork of the original repository that support rebar:
1 2 3
Step 2: Get and compile webdrv
Go to the root of your Erlang project and execute:
Step 3: Get & start the Google chromedriver
1 2 3
The last line starts up the Chromedriver server and if all went well, you should get the following output:
Important! This server needs to be running during test execution.
Step 4: Your first Erlang webdrvr test!
Save the following module in
src/random_org_test.erl. In this test we open a page, fill in a form, submit the form, and check if an expected piece of text is indeed present in the response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Step 5: Run the test
Run your test by opening up the Erlang shell..
..and execute the test function
You should see the Chrome browser opening in the background, quickly flashing some pages, closing, and on the Erlang shell the anticlamatic output
- Watch the Erlang Factory presentation by Hans Svensson from Quviq
- Erlang Webdrvr Github repository
- Selenium Webdriver documentation