From cc3ef1c065bbd65b3cf7844c00c72da7a9decf3d Mon Sep 17 00:00:00 2001 From: tecnovert Date: Mon, 28 Oct 2024 22:05:45 +0200 Subject: [PATCH] tests: Add Selenium webdriver options. --- tests/basicswap/selenium/util.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/basicswap/selenium/util.py b/tests/basicswap/selenium/util.py index 1123553..00c089c 100644 --- a/tests/basicswap/selenium/util.py +++ b/tests/basicswap/selenium/util.py @@ -7,7 +7,6 @@ # file LICENSE or http://www.opensource.org/licenses/mit-license.php. import os -from selenium.webdriver import Firefox from selenium.webdriver.common.by import By @@ -15,10 +14,22 @@ BSX_0_PORT = int(os.getenv('BSX_0_PORT', 12701)) BSX_1_PORT = int(os.getenv('BSX_1_PORT', BSX_0_PORT + 1)) BSX_2_PORT = int(os.getenv('BSX_1_PORT', BSX_0_PORT + 2)) +BSX_SELENIUM_DRIVER = os.getenv('BSX_SELENIUM_DRIVER', 'firefox') + def get_driver(): - # driver = Chrome() # 2023-11: Hangs here - driver = Firefox() + if BSX_SELENIUM_DRIVER == 'firefox': + from selenium.webdriver import Firefox, FirefoxOptions + driver = Firefox(options=FirefoxOptions()) + elif BSX_SELENIUM_DRIVER == 'chrome': + from selenium.webdriver import Chrome, ChromeOptions + driver = Chrome(options=ChromeOptions()) + elif BSX_SELENIUM_DRIVER == 'safari': + from selenium.webdriver import Safari, SafariOptions + driver = Safari(options=SafariOptions()) + else: + raise ValueError('Unknown driver ' + BSX_SELENIUM_DRIVER) + return driver