tests: Add Selenium webdriver options.
Some checks are pending
lint / build (3.12) (push) Waiting to run

This commit is contained in:
tecnovert 2024-10-28 22:05:45 +02:00
parent 1d5d6004bc
commit cc3ef1c065
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93

View file

@ -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