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!

Django app to run selenium webdriver tests.

Project Description
# django-webdriver

Django app to run selenium tests with webdriver

## Features

Extends the feature of [django-nose]( to manage the selenium tests.

## Installation

You can get django-webdriver from PyPi:
pip install django-webdriver

To use it you should add it to your `INSTALLED_APPS` in ``.
Django-webdriver uses django-nose to run the tests, so you should also configure django-nose in your project:


TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

## Usage

With django-webdriver you may run just unit tests or just selenium tests or the both.

### Launch tests

* `--selenium-only`: only run selenium tests
* `--with-selenium`: run all tests (unit and selenium)
* ` `: will only run unit test.

### Configure

#### Local

Add `--webdriver=` to specify webdriver you want to use locally.

It can be one of these for example (be careful to case):
* Firefox
* PhantomJS
* Chrome
* ...
* [More here](

##### Example

./ test --with-selenium --webdriver=PhantomJS

#### Remote

* Add `--remote_selenium_provider=` to specify which remote grid you want to use.
* Add configuration for each grid in your ``:
'remote_providers': {
'grid': {
'url': '',
# will use 'default' capabilities
'sauce-lab': {
'url': 'http://my_url',
'capabilities': 'ie',
'remote_capabilities': {
'default': [
'browser': 'firefox',
'platform': 'WINDOWS'
'ie': [
'browser: 'internet explorer',
'version': 6,

### Write selenium tests

To write selenium tests you have to name the files ``. You may also use a python module name `tests_selenium` but you have to define your test files in the ``.

Your selenium test classes have to inherit of `django_webdriver.base.DjangoWebdriverTestCase`.
You have not to manage the life cycle of the webdriver in the setUp or in the tearDown methods. The webdriver is instanciated before the setUp and it is stoped after the tearDown, so you may use it in these methods.

from django_webdriver.base import DjangoWebdriverTestCase

class TestSelenium(DjangoWebdriverTestCase):

def setUp(self):
self.webdriver.get('') #it's ok
self.webdriver = '...' #it's forbiden because you break the life cycle.

def tearDown(self):
self.webdriver... #it's ok
self.webdriver.quit() #it's forbiden because you break the life cycle too.

def test_google(self):
url = ''
self.assertEqual(url, self.webdriver.current_url)

Release History

Release History

This version
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
django-webdriver-0.1.2.tar.gz (10.8 kB) Copy SHA256 Checksum SHA256 Source Apr 15, 2014

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