Skip to content

Commit

Permalink
Use headless mode for CI tests
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Dec 6, 2024
1 parent fbcbdac commit b0ab672
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ private static void provideChromeDriver() throws IOException {
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);

// Add headless arguments
options.addArguments("--headless=new"); // new headless mode for Chrome v109+
options.addArguments("--disable-gpu"); // required for some systems
options.addArguments("--no-sandbox"); // required for CI environments
options.addArguments("--disable-dev-shm-usage"); // prevent Chrome from running out of memory
options.addArguments("--window-size=1600,1280"); // set window size

// Optional but recommended arguments for CI environments
options.addArguments("--disable-extensions");
options.addArguments("--disable-notifications");
options.addArguments("--remote-allow-origins=*");

webDriver = new ChromeDriver(service, options);
}

Expand Down

0 comments on commit b0ab672

Please sign in to comment.