How to use webdriver mobile web on desktop browser
Google Chrome provides a mechanism for emulating mobile devices when you instantiate the driver, see the full docs here.
Example:
Map<String, String> mobileEmulation = new HashMap<String, String>();mobileEmulation.put("deviceName", "Google Nexus 5");Map<String, Object> chromeOptions = new HashMap<String, Object>();chromeOptions.put("mobileEmulation", mobileEmulation);DesiredCapabilities capabilities = DesiredCapabilities.chrome();capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);WebDriver driver = new ChromeDriver(capabilities);