From 2e2d7b72391219249bb7898ab5459a5ce58cac73 Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Tue, 28 Feb 2023 16:56:20 +0100 Subject: [PATCH] Use the correct way to run browser in headless mode --- test/functional/services/remote/webdriver.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/functional/services/remote/webdriver.ts b/test/functional/services/remote/webdriver.ts index af2e1056e6867..f7de7159fc5df 100644 --- a/test/functional/services/remote/webdriver.ts +++ b/test/functional/services/remote/webdriver.ts @@ -99,9 +99,12 @@ function initChromiumOptions(browserType: Browsers, acceptInsecureCerts: boolean } if (headlessBrowser === '1') { + // Using the new headless mode (instead of `options.headless()`) + // See: https://www.selenium.dev/blog/2023/headless-is-going-away/ + options.addArguments('headless=new'); + // Use --disable-gpu to avoid an error from a missing Mesa library, as per // See: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md - options.headless(); options.addArguments('disable-gpu'); } @@ -111,7 +114,10 @@ function initChromiumOptions(browserType: Browsers, acceptInsecureCerts: boolean if (remoteDebug === '1') { // Visit chrome://inspect in chrome to remotely view/debug - options.headless(); + + // Using the new headless mode (instead of `options.headless()`) + // See: https://www.selenium.dev/blog/2023/headless-is-going-away/ + options.addArguments('headless=new'); options.addArguments('disable-gpu', 'remote-debugging-port=9222'); }