Skip to content

Instantly share code, notes, and snippets.

@winhamwr
Created July 7, 2010 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save winhamwr/467205 to your computer and use it in GitHub Desktop.
Save winhamwr/467205 to your computer and use it in GitHub Desktop.
import logging
from selenium.firefox.webdriver import WebDriver
from django.conf import settings
from django.test import TestCase
djangoassets_logger = logging.getLogger('assets.cssutils')
djangoassets_logger.setLevel(logging.WARNING)
logging.basicConfig(level=logging.WARNING)
class SeleniumTestCase(TestCase):
selenium = True
selenium_take_ss = True
selenium_driver_attr = 'driver'
def setUp(self, *args, **kwargs):
selenium_profile = getattr(settings, 'SELENIUM_FF_PROFILE', None)
self.driver = WebDriver(profile=selenium_profile)
root_logger = logging.getLogger('root')
root_logger.setLevel(logging.WARNING)
def tearDown(self):
# Need to disable the onbeforeunload event or stuff is going to break
# if we had a failed test that now won't close
self.driver.execute_script('window.onbeforeunload = function(){};')
# Nose handles the driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment