I am writing selenium script for testing different mobile views,
I used below code to run the script for "Apple iPhone 5" for the instance.
static DesiredCapabilities capabilities;
static String deviceName;
public static void main(String[] args) {
//some Sample Devices. Complete list can be found here: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/test/chromedriver/chrome/mobile_device_list.cc
//pick any of the device
// deviceName = "Google Nexus 5";
// deviceName = "Samsung Galaxy S4";
// deviceName = "Samsung Galaxy Note 3";
// deviceName = "Samsung Galaxy Note II";
// deviceName = "Apple iPhone 4";
deviceName = "Apple iPhone 5";
// deviceName = "Apple iPad 3 / 4";
System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\driver\\chromedriver.exe");
Map<String, String> mobileEmulation = new HashMap<String, String>();
mobileEmulation.put("deviceName", deviceName);
Map<String, Object> chromeOptions = new HashMap<String, Object>();
chromeOptions.put("mobileEmulation", mobileEmulation);
capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
WebDriver driver = new ChromeDriver(capabilities);
driver.manage().window().maximize();
driver.navigate().to("http://www.google.com");
}
When I run this I am getting error like unknown error: unrecognized chrome option: mobileEmulation
Please help me to get proper reference to write selenium script for mobile emulation(mobile height and width should be changed based on device),
and let me know the issue with the existing code.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/1d02bcf4-78c6-4d81-b034-59d38f77e341%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.