From 31a52862ae63520b0f9ef1ceffb9c8b6b75fac50 Mon Sep 17 00:00:00 2001 From: ElliotNewtonMiller Date: Tue, 10 Feb 2026 23:44:14 -0800 Subject: [PATCH] [javascript] Add headless flag to internal Chrome tests --- javascript/selenium-webdriver/testing/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/javascript/selenium-webdriver/testing/index.js b/javascript/selenium-webdriver/testing/index.js index a572e69a9ee53..788137958ebe2 100644 --- a/javascript/selenium-webdriver/testing/index.js +++ b/javascript/selenium-webdriver/testing/index.js @@ -343,6 +343,16 @@ class Environment { builder.setCapability('moz:debuggerAddress', true) } + // Necessary to connect the driver to Chrome browser from within Bazel. + if (browser.name === Browser.CHROME && process.env.BAZEL_TEST) { + let options = builder.getChromeOptions() + if (!options) { + options = new chrome.Options() + } + options.addArguments('--headless=new') + builder.setChromeOptions(options) + } + // Enable BiDi for supporting browsers. if (browser.name === Browser.FIREFOX || browser.name === Browser.CHROME || browser.name === Browser.EDGE) { builder.setCapability('webSocketUrl', true)