|
52 | 52 | import org.openqa.selenium.Dimension; |
53 | 53 | import org.openqa.selenium.Point; |
54 | 54 | import org.openqa.selenium.ScreenOrientation; |
| 55 | +import org.openqa.selenium.DeviceRotation; |
55 | 56 | import org.openqa.selenium.WebDriver; |
56 | 57 | import org.openqa.selenium.WebDriverException; |
57 | 58 | import org.openqa.selenium.WebElement; |
@@ -225,7 +226,7 @@ private static CommandInfo deleteC(String url) { |
225 | 226 | @Override public List<T> findElements(By by) { |
226 | 227 | return super.findElements(by); |
227 | 228 | } |
228 | | - |
| 229 | + |
229 | 230 | @Override public List<T> findElements(String by, String using) { |
230 | 231 | return super.findElements(by, using); |
231 | 232 | } |
@@ -630,7 +631,24 @@ protected void setSetting(AppiumSetting setting, Object value) { |
630 | 631 | throw new WebDriverException("Unexpected orientation returned: " + orientation); |
631 | 632 | } |
632 | 633 | } |
633 | | - |
| 634 | + |
| 635 | + @Override |
| 636 | + public void rotate(DeviceRotation rotation) { |
| 637 | + execute(DriverCommand.SET_SCREEN_ROTATION, |
| 638 | + ImmutableMap.of("orientation", rotation.parameters())); |
| 639 | + } |
| 640 | + |
| 641 | + @Override |
| 642 | + public DeviceRotation rotation() { |
| 643 | + Response response = execute(DriverCommand.GET_SCREEN_ROTATION); |
| 644 | + Map<String, Integer> map = null;// = response.readEntity(Map.class); |
| 645 | + DeviceRotation deviceRotation = new DeviceRotation(map); |
| 646 | + if (deviceRotation.getX() < 0 || deviceRotation.getY() < 0 || deviceRotation.getZ() < 0) { |
| 647 | + throw new WebDriverException("Unexpected orientation returned: " + deviceRotation); |
| 648 | + } |
| 649 | + return deviceRotation; |
| 650 | + } |
| 651 | + |
634 | 652 | @Override public Location location() { |
635 | 653 | return locationContext.location(); |
636 | 654 | } |
|
0 commit comments