Selenium + Java · Lesson 32 of 44
Module 32: Browser Options & Capabilities
Your task
Implement createHeadlessChromeOptions:
Write it in the editor, then press Check answer (Ctrl + Enter).
import org.openqa.selenium.chrome.ChromeOptions;
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new"); // Modern headless mode in Chrome
options.addArguments("--window-size=1920,1080");
options.addArguments("--disable-notifications");
options.addArguments("--incognito");
WebDriver driver = new ChromeDriver(options);CI pipelines execute tests headlessly without display hardware. In this lesson, you will configure ChromeOptions with arguments like --headless, --disable-notifications, and configure default download directories. Let's master browser options!
Part of the Selenium + Java course (Selenium with Java). Practice this concept live in the Selenium Online Compiler or explore our free automation practice form.
In Chrome 109+, '--headless=new' uses the unified browser architecture, matching normal Chrome rendering and reducing headless-only test bugs.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___