Skip to content

Commit

Permalink
More on upgrading chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Nov 13, 2023
1 parent 6f48204 commit c1a545d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/simple/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,9 @@ def gettext(s):

# For Selenium tests
# FIREFOX_BIN_PATH = ''
FIREFOX_BIN_PATH = None
# FIREFOX_BIN_PATH = None
# PHANTOM_JS_EXECUTABLE_PATH = None
PHANTOM_JS_EXECUTABLE_PATH = ""
# PHANTOM_JS_EXECUTABLE_PATH = ""

# CHROME_DRIVER_EXECUTABLE_PATH = os.environ.get('CHROME_BIN', None)
CHROME_DRIVER_EXECUTABLE_PATH = None
Expand Down
4 changes: 2 additions & 2 deletions examples/simple/settings/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def gettext(s):
# CHROME_DRIVER_OPTIONS.add_argument('-single-process')

CHROME_DRIVER_EXECUTABLE_PATH = binary_path # '/usr/bin/chromedriver'
FIREFOX_BIN_PATH = "/usr/lib/firefox/firefox"
PHANTOM_JS_EXECUTABLE_PATH = ""
# FIREFOX_BIN_PATH = "/usr/lib/firefox/firefox"
# PHANTOM_JS_EXECUTABLE_PATH = ""

# Do not put any settings below this line
try:
Expand Down
16 changes: 8 additions & 8 deletions src/fobi/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.management import call_command
from django.urls import reverse
from chromedriver_py import binary_path
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
Expand Down Expand Up @@ -60,19 +62,14 @@ def tearDown(self):
def setUpClass(cls):
"""Set up class."""
chrome_driver_path = getattr(
settings, "CHROME_DRIVER_EXECUTABLE_PATH", None
settings, "CHROME_DRIVER_EXECUTABLE_PATH", binary_path
)
chrome_driver_options = getattr(settings, "CHROME_DRIVER_OPTIONS", None)
chrome_driver_options = Options()
firefox_bin_path = getattr(settings, "FIREFOX_BIN_PATH", None)
phantom_js_executable_path = getattr(
settings, "PHANTOM_JS_EXECUTABLE_PATH", None
)
if chrome_driver_path is not None:
cls.driver = webdriver.Chrome(
executable_path=chrome_driver_path,
options=chrome_driver_options,
)
elif phantom_js_executable_path is not None:
if phantom_js_executable_path is not None:
if phantom_js_executable_path:
cls.driver = webdriver.PhantomJS(
executable_path=phantom_js_executable_path
Expand All @@ -82,6 +79,9 @@ def setUpClass(cls):
elif firefox_bin_path:
binary = FirefoxBinary(firefox_bin_path)
cls.driver = webdriver.Firefox(firefox_binary=binary)
if chrome_driver_path is not None:
chrome_driver_options.binary_location = chrome_driver_path
cls.driver = webdriver.Chrome(options=chrome_driver_options)
else:
cls.driver = webdriver.Firefox()

Expand Down

0 comments on commit c1a545d

Please sign in to comment.