Orientation

To rotate screen to LandScape mode:

Create a reusable function using DeviceRotation class

helper.java
  public static void testLandscapeRightRotation() {
        DeviceRotation rotation = new DeviceRotation(0, 0, 90);
        driver.rotate(rotation);
        assertEquals(driver.rotation(), rotation);
    }

To rotate screen to LandScape mode, import above function from helper.java class

test.java

$ helper.testLandscapeRightRotation();

To rotate screen to Portrait mode:

Create a reusable function using DeviceRotation class

helper.java
  public static void testPortraitRightRotation() {
        DeviceRotation rotation = new DeviceRotation(0, 0, 180);
        driver.rotate(rotation);
        assertEquals(driver.rotation(), rotation);
    }

To rotate screen to Portrait mode, import above function from helper.java class

test.java

$ helper.testPortraitRightRotation();

Last updated