Skip to content

Commit

Permalink
clean up selenium code a little
Browse files Browse the repository at this point in the history
  • Loading branch information
lainets authored and PasiSa committed Jun 16, 2021
1 parent 593f9f9 commit 6d6baff
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions selenium_test/test/test_initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Browser(enum.Enum):
firefox = "Firefox"
chrome = "Chrome"

class TestInitializer(object):
class TestInitializer:

def getDefaultDriver(self, headless=False, browser="Firefox"):
driver = self.getDriver(headless, browser)
Expand All @@ -28,22 +28,17 @@ def getDriver(self, headless=False, browser="Firefox"):
print('Browser: ' + browser)

if Browser.firefox.value == browser:
browser_opts = webdriver.firefox.options.Options
options = self.setHeadless(browser_opts, headless)
options = webdriver.firefox.options.Options()
options.headless = headless
driver = webdriver.Firefox(options=options)

elif Browser.chrome.value == browser:
browser_opts = webdriver.chrome.options.Options
options = self.setHeadlessChrome(browser_opts, headless)
options = webdriver.chrome.options.Options()
options.headless = headless
driver = webdriver.Chrome(chrome_options=options)

return driver

def setHeadless(self, browser_opts, headless):
options = browser_opts()
options.headless = headless
return options

# This just replaces the current database with a copy.
# TODO Should use Django unit tests that run selenium.
def recreateDatabase(self):
Expand Down

0 comments on commit 6d6baff

Please sign in to comment.