Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time


For browser automation and writing integration tests in Elixir.

Source | Documentation

Build Status


  • Can run multiple browser sessions simultaneously. See example.

  • Supports Selenium (Firefox, Chrome), ChromeDriver and PhantomJs.

  • Supports Javascript-heavy apps. Retries a few times before reporting error.

  • Implements the WebDriver Wire Protocol.

Internet Explorer may work under Selenium, but hasn't been tested.


ExUnit example
defmodule HoundTest do
  use ExUnit.Case
  use Hound.Helpers


  test "the truth", meta do

    element = find_element(:name, "message")
    fill_field(element, "Happy Birthday ~!")

    assert page_title() == "Thank you"


Here's another simple browser-automation example.


Hound requires Elixir 1.0.4 or higher.

  • Add dependency to your mix project
{:hound, "~> 1.0"}
  • Start Hound in your test/test_helper.exs file before the ExUnit.start() line:

When you run mix test, Hound is automatically started. You'll need a webdriver server running, like Selenium Server or Chrome Driver. If you aren't sure what it is, then read this.

If you're using Phoenix

Ensure the server is started when your tests are run. In config/test.exs change the server option of your endpoint config to true:

config :hello_world_web, HelloWorldWeb.Endpoint,
  http: [port: 4001],
  server: true


To configure Hound, use your config/config.exs file or equivalent.


config :hound, driver: "phantomjs"

More examples here.


Add the following lines to your ExUnit test files.

# Import helpers
use Hound.Helpers

# Start hound session and destroy when tests are run

If you prefer to manually start and end sessions, use Hound.start_session and Hound.end_session in the setup and teardown blocks of your tests.


The documentation pages include examples under each function.

The docs are at

More examples? Checkout Hound's own test cases


Can I run multiple browser sessions simultaneously

Oh yeah ~! Here is an example.

If you are running PhantomJs, take a look at the Caveats section below.

Can I run tests async?


The number of tests you can run async at any point in time, depends on the number of sessions that your webdriver can maintain at a time. For Selenium Standalone, there seems to be a default limit of 15 sessions. You can set ExUnit's async option to limit the number of tests to run parallelly.

Will Hound guarantee an isolated session per test?

Yes. A separate session is started for each test process.

PhantomJs caveats

PhantomJs is extremely fast, but there are certain caveats. It uses Ghostdriver for its webdriver server, which currently has unimplemented features or open issues.

  • Cookie jar isn't separate for sessions - ariya/phantomjs#11417 Which means all sessions share the same cookies. Make sure you run delete_cookies() at the end of each test.
  • Isolated sessions were added to GhostDriver recently and are yet to land in a PhantomJs release.
  • Javascript alerts aren't yet supported -

Running tests

You need a webdriver in order to run tests. We recommend phantomjs but any can be used by setting the WEBDRIVER environment variable as shown below:

$ phantomjs --wd
$ WEBDRIVER=phantomjs mix test


Customary proclamation...

Copyright © 2013-2015, Akash Manohar J, under the MIT License (basically, do whatever you want)