Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to perform the screen rotation in Appium ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.15k
    Comment on it

    Many times the application screen has to be rotated to automate any testcase. Most of the applications opens in portrait mode and if there we have to verify something in landscape mode then we cannot rotate the screen manually in the middle to any test. The optimal solution of this issue is that we should set the orientation programmatically after the step we want orientation and again reset the position once the action is completed. There are four orientation provided by the android:

    • unspecified: The default state
    • portrait
    • landscape
    • sensor

    We have to pass the orientation type in the method rotate(org.openqa.selenium.ScreenOrientation orientation) to rotate the screen.

    Suppose, we have to rotate the screen in landscape mode from the portrait mode and perform some action and then again rotate the screen back to portrait mode.

    1. //Launch the application
    2. driver.rotate(landscape);
    3. //Perform some desired actions and again switch to portrait mode
    4. driver.rotate(portrait);
    5. //Continue the test

    In this way we can rotate the screen as per the requirement.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: