In the Lambdatest platform, how do you do mobile emulation in Chrome?
Hi rebecca,
To achieve the same using automation, we will have to add the user agent, width, and height.
Here is the capability to pass additionaly- Map<String, Object> deviceMetrics = new HashMap<>();deviceMetrics.put(“width”, 375);deviceMetrics.put(“height”, 812);deviceMetrics.put(“pixelRatio”, 3.0);Map<String, Object> mobileEmulation = new HashMap<>();mobileEmulation.put(“deviceMetrics”, deviceMetrics);mobileEmulation.put(“userAgent”, “Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1”);ChromeOptions chromeOptions = new ChromeOptions();chromeOptions.setExperimentalOption(“mobileEmulation”, mobileEmulation);capabilities.setCapability(ChromeOptions.CAPABILITY,chromeOptions);