Skip to content

Commit

Permalink
Merge pull request #317 from valholl/chromium
Browse files Browse the repository at this point in the history
Fallback to Chrom(e|ium) if the Firefox driver for selenium isn't available
  • Loading branch information
ThomasWaldmann authored Jan 5, 2024
2 parents 36d882d + cd9045f commit fce1806
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/bepasty/tests/test_website.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from selenium.webdriver import Firefox
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver import Chrome
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import (
NoSuchDriverException, NoSuchElementException
)

import pytest

Expand All @@ -17,7 +21,11 @@ def setup_class(self):
"""
Setup: Open a mozilla browser, login
"""
self.browser = Firefox()
try:
self.browser = Firefox()
except NoSuchDriverException:
service = ChromeService(executable_path="/usr/bin/chromedriver")
self.browser = Chrome(service=service)
self.browser.get('http://localhost:5000/')
token = self.browser.find_element_by_name("token")
password = "foo"
Expand Down

0 comments on commit fce1806

Please sign in to comment.