diff --git a/google-style.xml b/google-style.xml index dd40c8a90..41edd5252 100755 --- a/google-style.xml +++ b/google-style.xml @@ -219,4 +219,4 @@ - \ No newline at end of file + diff --git a/pom.xml b/pom.xml index c735adb80..fa5ebf5a4 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,16 @@ gson 2.6.2 + + org.seleniumhq.selenium + selenium-api + 2.53.0 + + + org.seleniumhq.selenium + selenium-chrome-driver + 2.53.0 + org.seleniumhq.selenium selenium-java @@ -38,6 +48,16 @@ + + org.seleniumhq.selenium + selenium-remote-driver + 2.53.0 + + + org.seleniumhq.selenium + selenium-support + 2.53.0 + junit junit diff --git a/src/main/java/io/appium/java_client/AppiumDriver.java b/src/main/java/io/appium/java_client/AppiumDriver.java index 1e54423fe..458e80b4c 100644 --- a/src/main/java/io/appium/java_client/AppiumDriver.java +++ b/src/main/java/io/appium/java_client/AppiumDriver.java @@ -52,6 +52,7 @@ import org.openqa.selenium.Dimension; import org.openqa.selenium.Point; import org.openqa.selenium.ScreenOrientation; +import org.openqa.selenium.DeviceRotation; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.WebElement; @@ -225,11 +226,11 @@ private static CommandInfo deleteC(String url) { @Override public List findElements(By by) { return super.findElements(by); } - + @Override public List findElements(String by, String using) { return super.findElements(by, using); } - + @Override public List findElementsById(String id) { return super.findElementsById(id); } @@ -630,7 +631,22 @@ protected void setSetting(AppiumSetting setting, Object value) { throw new WebDriverException("Unexpected orientation returned: " + orientation); } } - + + @Override + public void rotate(DeviceRotation rotation) { + execute(DriverCommand.SET_SCREEN_ROTATION, rotation.parameters()); + } + + @Override + public DeviceRotation rotation() { + Response response = execute(DriverCommand.GET_SCREEN_ROTATION); + DeviceRotation deviceRotation = new DeviceRotation((Map)response.getValue()); + if (deviceRotation.getX() < 0 || deviceRotation.getY() < 0 || deviceRotation.getZ() < 0) { + throw new WebDriverException("Unexpected orientation returned: " + deviceRotation); + } + return deviceRotation; + } + @Override public Location location() { return locationContext.location(); }