Navigate back or home screen using Appium


Class AndroidDriver (implements AppiumDriver interface)  has method pressKeyCode(int key) for your handset / emulator to navigate to Home screen or navigating back.

the argument key can be any one of the option from below link

To navigate to home screen:

Navigate to back screen:

Let’s see how we can implement in code those above 2 statements


Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our, Thanks!

2 Responses

  1. Bharath G says:

    hi i’m using driver.pressKeyCode(AndroidKeyCode.KEYCODE_CAMERA); to click picture in camera but it’s not working

  2. sunilpatro1985 says:

    can you try this one –
    Runtime.getRuntime().exec(“cmd /C adb shell input keyevent ” + 27);

Leave a Reply

Your email address will not be published. Required fields are marked *