Skip to content

Commit

Permalink
Use old headless mode in Chrome browser
Browse files Browse the repository at this point in the history
This also sets the environment variables necessary to tell Selenium to
reuse the browsers set up in the Dockerfile instead of downloading
them on its own.
  • Loading branch information
replaceafill authored Sep 30, 2024
1 parent ee8fdd1 commit b150e1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ FROM base AS archivematica-acceptance-tests
ARG USER_ID=1000
ARG GROUP_ID=1000

ENV SE_MANAGER_PATH=${SELENIUM_DIR}/bin/selenium-manager
ENV SE_CHROME_PATH=${SELENIUM_DIR}/bin/google-chrome
ENV SE_FIREFOX_PATH=${SELENIUM_DIR}/bin/firefox

RUN set -ex \
&& apt-get -qqy update \
&& apt-get -qqy --no-install-recommends install \
Expand Down
2 changes: 1 addition & 1 deletion amuser/selenium_ability.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_driver(self):
if self.driver_name == "Chrome":
options = webdriver.ChromeOptions()
if headless:
options.add_argument("--headless=new")
options.add_argument("--headless=old")
driver = webdriver.Chrome(options=options)
driver.set_window_size(1700, 900)
elif self.driver_name == "Firefox":
Expand Down
2 changes: 1 addition & 1 deletion simplebrowsertest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def get_chrome_driver():
options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("--headless=old")
driver = webdriver.Chrome(options=options)
return driver

Expand Down

0 comments on commit b150e1b

Please sign in to comment.