xxxxxxxxxx
Map<String, String> mobileEmulation = new HashMap<>();
// adding name of the device to emulate
mobileEmulation.put("deviceName", "iPhone X");
ChromeOptions chromeOptions = new ChromeOptions();
// Experimental Option needs to be set for emulation
chromeOptions.setExperimentalOption("mobileEmulation", mobileEmulation);
WebDriver driver = new ChromeDriver(chromeOptions);