summaryrefslogtreecommitdiff
path: root/test/cors
diff options
context:
space:
mode:
authorAlistair Coles <alistairncoles@gmail.com>2021-03-17 11:47:24 +0000
committerTim Burke <tim.burke@gmail.com>2021-03-17 15:57:02 -0700
commite572938af349a51ff755d493203fce1d2ef777d5 (patch)
treea8bb07a8267dfff37c78b62d00a15573ce2097d3 /test/cors
parent354a86a80ee6de462c240c5684bf982c806bf7a7 (diff)
downloadswift-e572938af349a51ff755d493203fce1d2ef777d5.tar.gz
Use headless option for cors functional test runner
Some selenium webdrivers (e.g. Chrome, Firefox) support a headless option so we can expose that as an option for the test runner too. Use this in an attempt to fix "Error: cannot open display: :99" errors seen in the gate. Related-Bug: #1918864 Change-Id: I2a549ce829eb0bc38406575582202e1d8dd1a0e2
Diffstat (limited to 'test/cors')
-rwxr-xr-xtest/cors/main.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/cors/main.py b/test/cors/main.py
index 8f4314d9f..5da06ae68 100755
--- a/test/cors/main.py
+++ b/test/cors/main.py
@@ -180,9 +180,19 @@ def run(args, url):
browsers = list(ALL_BROWSERS) if 'all' in args.browsers else args.browsers
ran_one = False
for browser_name in browsers:
+ kwargs = {}
+ try:
+ options = getattr(
+ selenium.webdriver, browser_name.title() + 'Options')()
+ options.headless = True
+ kwargs['options'] = options
+ except AttributeError:
+ # not all browser types have Options class
+ pass
+
driver = getattr(selenium.webdriver, browser_name.title())
try:
- browser = driver()
+ browser = driver(**kwargs)
except Exception as e:
if not ('needs to be in PATH' in str(e) or
'SafariDriver was not found' in str(e)):