I was using Chrome mobile emulation with Selenium 3 on LambdaTest, but since upgrading to Selenium 4, I’m unable to use it. How do I pass it with LT:Options?
Hi Tom,
You can refer to the following code for passing Chrome mobile emulation ChromeOptions with LT:Options in Selenium 4.
Map<String, String> mobileEmulation = new HashMap<>();
mobileEmulation.put("deviceName", "iPhone 6");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("mobileEmulation",mobileEmulation);
chromeOptions.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
chromeOptions.setCapability("browserName", "Chrome");
HashMap<String, Object> ltOptions = new HashMap<String, Object>();
ltOptions.put("username", "");
ltOptions.put("accessKey", "");
ltOptions.put("platformName", "Windows 10");
ltOptions.put("browserVersion", "114.0");
ltOptions.put("build", "Mobile Emulation");
ltOptions.put("test", "Test 1");
ltOptions.put("w3c", true);
chromeOptions.setCapability("LT:Options", ltOptions);
RemoteWebDriver driver = new RemoteWebDriver(new URL(LT_GRID_URL), chromeOptions);