Permalink
Browse files

Allow the option of using chrome.

  • Loading branch information...
1 parent 9ab2261 commit 5b39ab91496f4687680f838f03eff0954e82ddae @mithro mithro committed Feb 25, 2012
Showing with 22 additions and 9 deletions.
  1. +1 −0 .gitignore
  2. +21 −9 usergroup/selenium_tests/base.py
View
@@ -17,3 +17,4 @@ build/
.Python
vncserver.stdout
firefox
+chromedriver*
@@ -40,15 +40,27 @@ class SeleniumTestCase(LiveServerTestCase):
def setUp(self):
LiveServerTestCase.setUp(self)
- profile = FirefoxProfile()
- profile.set_preference('plugins.hide_infobar_for_missing_plugin', True)
-
- firefox_bin = os.path.join('firefox', 'firefox')
- if os.path.exists(firefox_bin):
- self.browser = webdriver.Firefox(firefox_profile=profile, firefox_binary=FirefoxBinary(firefox_bin))
- else:
- warnings.warn("Using your default firefox, this can be unreliable!")
- self.browser = webdriver.Firefox(firefox_profile=profile)
+ browser = os.environ.get("TEST_DRIVER", "firefox")
+ if browser == "firefox":
+ profile = FirefoxProfile()
+ profile.set_preference('plugins.hide_infobar_for_missing_plugin', True)
+
+ firefox_bin = os.path.join(os.getcwd(), 'firefox', 'firefox')
+ if os.path.exists(firefox_bin):
+ self.browser = webdriver.Firefox(firefox_profile=profile, firefox_binary=FirefoxBinary(firefox_bin))
+ else:
+ warnings.warn("Using your default firefox, this can be unreliable!")
+ self.browser = webdriver.Firefox(firefox_profile=profile)
+ elif browser == "chrome":
+ chromedriver_bin = os.path.join(os.getcwd(), 'chromedriver')
+ if not os.path.exists(chromedriver_bin):
+ raise SystemError("""\
+Unable to find chromedriver binary.
+
+Please download from http://code.google.com/p/chromedriver/downloads/list and
+put in your base directory.
+""")
+ self.browser = webdriver.Chrome(executable_path=chromedriver_bin)
self.browser_quitter = BrowserQuitter(self.browser)

0 comments on commit 5b39ab9

Please sign in to comment.