Skip to content

Commit

Permalink
Use the correct way to run browser in headless mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pheyos committed Feb 28, 2023
1 parent 90b0782 commit 2e2d7b7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/functional/services/remote/webdriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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');
}

Expand Down

0 comments on commit 2e2d7b7

Please sign in to comment.