Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Lightweight API around Selenium Webdriver for end to end testing with Django.

Project Description

Lightweight API around Selenium Webdriver and helpers for end to end testing
with Django.

This package is alpha, the API will most likely change!

It supports Django 1.6-1.8 for Python versions 2.7, 3.3, 3.4, 3.5 and pypy (where
the `Django version supports said Python version <>`_).

.. image::
:alt: Build Status

.. image::
:alt: Code Health

.. image::
:alt: Code Coverage

.. image::
:alt: Documentation Status

.. image::
:alt: Latest Version

.. image::
:alt: Supported Python versions

.. image::
:alt: Downloads


Available at ``_


You can install ghostly either via the Python Package Index (PyPI) or from

To install using pip;

.. code-block:: bash

pip install ghostly

From github;

.. code-block:: bash

$ pip install git+


You can use use this package outside of Django however it has limited use.

Essentially there are two components, as follows;

- ``Ghostly`` - A lightweight wrapper and helper methods for Selenium
Webdriver. Presently it provides a handful of methods that utilise xpath to
deal with a page, such as ``xpath``, ``xpath_wait`` et al.
- ``GhostlyDjangoTestCase`` - A lightweight test case that extends
`StaticLiveServerTestCase`_ and sets up an instance of ``Ghostly``. It
provides methods such as ``assertCurrentUrl``, ``assertXpathEqual`` et al.


``GhostlyDjangoTestCase`` inherits `StaticLiveServerTestCase`_ and thus fires up
a WSGI server that handles requests.

Given you have a named URL ``home`` with a ``<h1>Hello World</h1>`` visible in
the source, you can do the following;

.. code-block:: python

class MyTestCase(GhostlyDjangoTestCase):

def test_homepage(self):

# Assert that an element is equal to something
self.assertXpathEqual('//h1', 'Hello World')

# Assert the current url, relative or absolute

Working with SVG

To traverse SVG with Selenium web driver you must use xpath.

.. code-block:: python

class MyTestCase(GhostlyDjangoTestCase):

def test_homepage(self):

# Click on an element, or example, in an SVG.

# Assert that an Xpath is equal to something
self.assertXpathEqual('//h2', 'Hello World')

# Wait for xpath to exist


This package started out as a simple way to construct browser tests using YAML,
written by Brenton Cleeland.

The focus of this fork is to allow the developer to write programmatic unit
tests in the style of `unittest`_.

Currently this fork does not contain any of the CSS selector style methods that
were originally available as the focus has been on xpath only support until a
more robust CSS selector toolkit can be provided.


This software is licensed under the `MIT License`. See the ``LICENSE``
file in the top distribution directory for the full license text.


- Alex Hayes <>
- Brenton Cleeland <>

.. _StaticLiveServerTestCase:
.. _unittest:
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ghostly-0.2.4.tar.gz (913.3 kB) Copy SHA256 Checksum SHA256 Source Apr 22, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting