Search in sources :

Example 11 with Response

use of org.openqa.selenium.remote.Response in project java-client by appium.

the class AppiumDriver method rotation.

@Override
public DeviceRotation rotation() {
    Response response = execute(DriverCommand.GET_SCREEN_ROTATION);
    DeviceRotation deviceRotation = new DeviceRotation((Map<String, Number>) response.getValue());
    if (deviceRotation.getX() < 0 || deviceRotation.getY() < 0 || deviceRotation.getZ() < 0) {
        throw new WebDriverException("Unexpected orientation returned: " + deviceRotation);
    }
    return deviceRotation;
}
Also used : Response(org.openqa.selenium.remote.Response) DeviceRotation(org.openqa.selenium.DeviceRotation) WebDriverException(org.openqa.selenium.WebDriverException)

Aggregations

Response (org.openqa.selenium.remote.Response)11 WebDriverException (org.openqa.selenium.WebDriverException)5 Supplier (com.google.common.base.Supplier)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 IOException (java.io.IOException)2 ConnectException (java.net.ConnectException)2 Map (java.util.Map)2 W3CHttpCommandCodec (org.openqa.selenium.remote.http.W3CHttpCommandCodec)2 DriverService (org.openqa.selenium.remote.service.DriverService)2 GET_SESSION (io.appium.java_client.MobileCommand.GET_SESSION)1 Activity (io.appium.java_client.android.Activity)1 StartsActivity (io.appium.java_client.android.StartsActivity)1 AppiumW3CHttpCommandCodec (io.appium.java_client.remote.AppiumW3CHttpCommandCodec)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Optional.ofNullable (java.util.Optional.ofNullable)1 Collectors.toMap (java.util.stream.Collectors.toMap)1 Nullable (javax.annotation.Nullable)1 StringUtils.isBlank (org.apache.commons.lang3.StringUtils.isBlank)1