# Orientation

## To rotate screen to LandScape mode:

Create a reusable function using DeviceRotation class &#x20;

{% code title="helper.java" %}
```java
  public static void testLandscapeRightRotation() {
        DeviceRotation rotation = new DeviceRotation(0, 0, 90);
        driver.rotate(rotation);
        assertEquals(driver.rotation(), rotation);
    }
```
{% endcode %}

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 &#x20;

{% code title="helper.java" %}
```java
  public static void testPortraitRightRotation() {
        DeviceRotation rotation = new DeviceRotation(0, 0, 180);
        driver.rotate(rotation);
        assertEquals(driver.rotation(), rotation);
    }
```
{% endcode %}

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

```
test.java

$ helper.testPortraitRightRotation();
```
