public boolean isMobileDevice() { Capabilities browserCapabilities = ((RemoteWebDriver) se.driver()).getCapabilities(); String browserName = browserCapabilities.getBrowserName(); Platform platform = browserCapabilities.getPlatform(); if (browserName.equals("android") && platform.equals(Platform.ANDROID)) return true; else if ((browserName.equals("iOS") || browserName.equals("iPhone")) && platform.equals(Platform.MAC)) return true; else return false; }