From 9304c6d10dce339561bb1ecf53af13e73d6b7baf Mon Sep 17 00:00:00 2001 From: Corey Goldberg Date: Thu, 8 Nov 2012 10:47:20 -0500 Subject: [PATCH] updated README examples --- README.rst | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 34afe56..bfed3df 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,62 @@ -xvfbwrapper -=========== +=============== + xvfbwrapper +=============== Python wrapper for running display inside X virtual framebuffer (Xvfb) +************* + Requires: +************* + + * Xvfb (`sudo apt-get install xvfb` or similar) + +************ + Example: +************ + +:: + from xvfbwrapper import Xvfb + + vdisplay = Xvfb(width=1280, height=720) + vdisplay.start() + + # launch stuff inside virtual display here + + vdisplay.stop() + +**************************************************** + Example use with Selenium WebDriver and Firefox: +**************************************************** + +:: + from xvfbwrapper import Xvfb + + import unittest + from selenium import webdriver + class TestUbuntuHomepage(unittest.TestCase): + def setUp(self): + self.vdisplay = Xvfb(width=1280, height=720) + self.vdisplay.start() + self.browser = webdriver.Firefox() + + def testTitle(self): + self.browser.get('http://www.ubuntu.com') + self.assertIn('Ubuntu', self.browser.title) + + def tearDown(self): + self.browser.quit() + self.vdisplay.stop() + + + if __name__ == '__main__': + unittest.main(verbosity=2) + +*********************************************** + pip install latest dev branch from git repo +*********************************************** + +:: + + pip install -e git+http://github.com/cgoldberg/xvfbwrapper.git#egg=xvfbwrapper