AppiumDriverFactory implements
    Configurator<AppiumDriver, WebDriverConfiguration>,
    Instantiator<AppiumDriver, WebDriverConfiguration>,
    Destructor<AppiumDriver> { public Capabilities getCapabilities(WebDriverConfiguration configuration) { DesiredCapabilities capabilities = new DesiredCapabilities(configuration.getCapabilities()); String browser = (String)capabilities.getCapability(MobileCapabilityType.BROWSER_NAME); if (browser != null) browser = browser.toLowerCase(); if (MobileBrowserType.CHROME.toLowerCase().equals(browser)) { ChromeOptions chromeOptions = new ChromeOptions(); CapabilitiesOptionsMapper.mapCapabilities(chromeOptions, capabilities, ChromeDriverFactory.BROWSER_CAPABILITIES); capabilities.setCapability(AndroidMobileCapabilityType.CHROME_OPTIONS, chromeOptions); } return capabilities; }  @Override void destroyInstance(AppiumDriver instance); @Override int getPrecedence(); @Override AppiumDriver createInstance(WebDriverConfiguration configuration); Capabilities getCapabilities(WebDriverConfiguration configuration); @Override WebDriverConfiguration createConfiguration(ArquillianDescriptor descriptor, DronePoint<AppiumDriver> dronePoint);  }
@Test public void testCapabilities() throws IOException { DesiredCapabilities originalCapabilities = new DesiredCapabilities(); originalCapabilities.setCapability(PLATFORM_NAME, "android"); originalCapabilities.setCapability(BROWSER_NAME, "chrome"); originalCapabilities.setCapability("chromeArguments", CHROME_OPTIONS_VALUE); AppiumDriverFactory factory = new AppiumDriverFactory(); Capabilities newCapabilities = factory.getCapabilities(getMockedConfiguration(originalCapabilities)); assertEquals(originalCapabilities.getCapability(PLATFORM_NAME), newCapabilities.getCapability(PLATFORM_NAME)); assertEquals(originalCapabilities.getCapability(BROWSER_NAME), newCapabilities.getCapability(BROWSER_NAME)); Object chromeOptions = newCapabilities.getCapability(ChromeOptions.CAPABILITY); assertTrue(new Gson().toJson(chromeOptions).contains(CHROME_OPTIONS_VALUE)); }