diff --git a/securedrop/tests/functional/web_drivers.py b/securedrop/tests/functional/web_drivers.py index bddd4a5239..7386c75978 100644 --- a/securedrop/tests/functional/web_drivers.py +++ b/securedrop/tests/functional/web_drivers.py @@ -13,6 +13,7 @@ from selenium.webdriver.firefox.webdriver import WebDriver from selenium.webdriver.remote.remote_connection import LOGGER from tbselenium.tbdriver import TorBrowserDriver +from tbselenium.utils import set_tbb_pref _LOGFILE_PATH = abspath(join(dirname(realpath(__file__)), "../log/driver.log")) _FIREFOX_PATH = "/usr/bin/firefox/firefox" @@ -54,8 +55,6 @@ def _create_torbrowser_driver( "network.proxy.no_proxies_on": "127.0.0.1", "browser.privatebrowsing.autostart": False, } - if accept_languages is not None: - pref_dict["intl.accept_languages"] = accept_languages Path(_TBB_PATH).mkdir(parents=True, exist_ok=True) torbrowser_driver = None @@ -67,6 +66,12 @@ def _create_torbrowser_driver( pref_dict=pref_dict, tbb_logfile_path=_LOGFILE_PATH, ) + if accept_languages is not None: + # privacy.spoof_english per + # . + set_tbb_pref(driver, "privacy.spoof_english", 1) + set_tbb_pref(torbrowser_driver, "intl.accept_languages", accept_languages) + logging.info("Created Tor Browser web driver") torbrowser_driver.set_window_position(0, 0) torbrowser_driver.set_window_size(*_BROWSER_SIZE)