Source:
protected DesiredCapabilities initCapabilities(DesiredCapabilities capabilities) { final String prefix = SpecialKeywords.CAPABILITIES + "."; @SuppressWarnings({ "unchecked", "rawtypes" }) Map<String, String> capabilitiesMap = new HashMap(R.CONFIG.getProperties()); for (Map.Entry<String, String> entry : capabilitiesMap.entrySet()) { if (entry.getKey().toLowerCase().startsWith(prefix)) { String value = R.CONFIG.get(entry.getKey()); if (!value.isEmpty()) { String cap = entry.getKey().replaceAll(prefix, ""); if ("false".equalsIgnoreCase(value)) { LOGGER.debug("Set capabilities value as boolean: false"); capabilities.setCapability(cap, false); } else if ("true".equalsIgnoreCase(value)) { LOGGER.debug("Set capabilities value as boolean: true"); capabilities.setCapability(cap, true); } else { LOGGER.debug("Set capabilities value as string: " + value); capabilities.setCapability(cap, value); } } } } capabilities.setCapability("carinaTestRunId", SpecialKeywords.TEST_RUN_ID); String browser = Configuration.getBrowser(); if (BrowserType.FIREFOX.equalsIgnoreCase(browser)) { capabilities = addFirefoxOptions(capabilities); } else if (BrowserType.CHROME.equalsIgnoreCase(browser)) { capabilities = addChromeOptions(capabilities); } if (Configuration.getBoolean(Parameter.HEADLESS)) { if (BrowserType.FIREFOX.equalsIgnoreCase(browser) || BrowserType.CHROME.equalsIgnoreCase(browser) && Configuration.getDriverType().equalsIgnoreCase(SpecialKeywords.DESKTOP)) { LOGGER.info("Browser will be started in headless mode. VNC and Video will be disabled."); R.CONFIG.put("capabilities.enableVNC", "false"); R.CONFIG.put("capabilities.enableVideo", "false"); capabilities.setCapability("enableVNC", false); capabilities.setCapability("enableVideo", false); } else { LOGGER.error(String.format("Headless mode isn't supported by %s browser / platform.", browser)); } } return capabilities; }

Target:
protected DesiredCapabilities initCapabilities(DesiredCapabilities capabilities) { final String prefix = SpecialKeywords.CAPABILITIES + "."; @SuppressWarnings({ "unchecked", "rawtypes" }) Map<String, String> capabilitiesMap = new HashMap(R.CONFIG.getProperties()); for (Map.Entry<String, String> entry : capabilitiesMap.entrySet()) { if (entry.getKey().toLowerCase().startsWith(prefix)) { String value = R.CONFIG.get(entry.getKey()); if (!value.isEmpty()) { String cap = entry.getKey().replaceAll(prefix, ""); if ("false".equalsIgnoreCase(value)) { LOGGER.debug("Set capabilities value as boolean: false"); capabilities.setCapability(cap, false); } else if ("true".equalsIgnoreCase(value)) { LOGGER.debug("Set capabilities value as boolean: true"); capabilities.setCapability(cap, true); } else { LOGGER.debug("Set capabilities value as string: " + value); capabilities.setCapability(cap, value); } } } } capabilities.setCapability("carinaTestRunId", SpecialKeywords.TEST_RUN_ID); String browser = Configuration.getBrowser(); if (BrowserType.FIREFOX.equalsIgnoreCase(browser)) { capabilities = addFirefoxOptions(capabilities); } else if (BrowserType.CHROME.equalsIgnoreCase(browser)) { capabilities = addChromeOptions(capabilities); } if (Configuration.getBoolean(Parameter.HEADLESS)) { if (BrowserType.FIREFOX.equalsIgnoreCase(browser) || BrowserType.CHROME.equalsIgnoreCase(browser) && Configuration.getDriverType().equalsIgnoreCase(SpecialKeywords.DESKTOP)) { LOGGER.info("Browser will be started in headless mode. VNC and Video will be disabled."); capabilities.setCapability("enableVNC", false); capabilities.setCapability("enableVideo", false); } else { LOGGER.error(String.format("Headless mode isn't supported by %s browser / platform.", browser)); } } return capabilities; }