I'm trying to automate the mobile emulation in chrome browser. So I have done in local chrome execution successfully, not sure about the browserstack chrome mobile emulators. I just wanted to know how should we do the same in browserstack.
Similar to local chrome execution, just have to open a chrome browser with the given chrome options(android,ipad,iphone) in browserstack.
https://chromedriver.chromium.org/mobile-emulation
Local chrome Execution code snippet:
`"chromeAndroid": {
"deviceName": "Nexus 5"
},
"chromeiPhone": {
"deviceName": "iPhone 5"
},
"chromeiPad": {
"deviceName": "iPad"
},
Map<String, String> mobileEmulation = new HashMap<>();
mobileEmulation.put(pair.getKey().toString(), pair.getValue().toString());
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("mobileEmulation", mobileEmulation);
driver = new ChromeDriver(chromeOptions);`
We are parsing the data from above json file and pass it onto the chrome options.
Local chrome execution Screenshot:
Please suggest me by providing some details or code snippet for remoteWebdriver as we are running the browser stack tests from Jenkins and browserstack local.
Please help me!