Skip to content

Instantly share code, notes, and snippets.

@zoobab
Created August 16, 2016 12:50
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 zoobab/c2ca02418892158764c631720bbd3021 to your computer and use it in GitHub Desktop.
Save zoobab/c2ca02418892158764c631720bbd3021 to your computer and use it in GitHub Desktop.
root@9247c038a790:~# cat xvfb.py
from selenium import webdriver
from xvfbwrapper import Xvfb
import unittest
class TestPages(unittest.TestCase):
def setUp(self):
self.xvfb = Xvfb(width=1280, height=720)
self.addCleanup(self.xvfb.stop)
self.xvfb.start()
self.browser = webdriver.Firefox()
self.addCleanup(self.browser.quit)
def testFilezHomepage(self):
self.browser.get('http://filez.zoobab.com')
self.assertIn('Filez', self.browser.title)
# def testGoogleHomepage(self):
# self.browser.get('http://www.google.com')
# self.assertIn('Google', self.browser.title)
if __name__ == '__main__':
unittest.main(verbosity=2)
root@9247c038a790:~#
root@9247c038a790:~# python xvfb.py
testFilezHomepage (__main__.TestPages) ... ERROR
======================================================================
ERROR: testFilezHomepage (__main__.TestPages)
----------------------------------------------------------------------
Traceback (most recent call last):
File "xvfb.py", line 13, in setUp
self.browser = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 80, in __init__
self.binary, timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 108, in _wait_until_connectable
% (self.profile.path))
WebDriverException: Message: Can't load the profile. Profile Dir: /tmp/tmpfUJH8R If you specified a log_file in the FirefoxBinary constructor, check it for details.
----------------------------------------------------------------------
Ran 1 test in 30.537s
FAILED (errors=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment