### Question:
HeadlessFirefoxCapabilitiesBuilder extends FireFoxCapabilitiesBuilder { @Override public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities) { super.getCapabilities(capabilities); FirefoxOptions updated = new FirefoxOptions(capabilities); updated.setHeadless(true); capabilities.setCapability(FirefoxOptions.FIREFOX_OPTIONS, updated); return capabilities; }  @Override DesiredCapabilities getCapabilities(DesiredCapabilities capabilities);  }### Answer:
@Test public void testIsHeadless(ITestContext ctx) { LocalConfig lc = new LocalConfig(); lc.setConfigProperty(Config.ConfigProperty.BROWSER_RUN_HEADLESS, "false"); ConfigManager.addConfig(ctx.getCurrentXmlTest().getName(), lc); DesiredCapabilities capabilities = new HeadlessFirefoxCapabilitiesBuilder().getCapabilities(new DesiredCapabilities()); assertNotNull(capabilities.getCapability(FirefoxOptions.FIREFOX_OPTIONS)); Map<String, List<String>> firefoxOptionsMap = (Map<String, List<String>>) capabilities.getCapability(FirefoxOptions.FIREFOX_OPTIONS); assertTrue(firefoxOptionsMap.containsKey("args")); assertTrue(firefoxOptionsMap.get("args").contains("-headless")); }