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.09k
    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.

    //Launch the application
    driver.rotate(landscape);
    //Perform some desired actions and again switch to portrait mode
    driver.rotate(portrait);
    //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
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: