Search code examples
androidappiumback-button

Press Android Back button with appium in -no-window mode


I'm starting the android emulator with emulator.exe -no-window and trying to send the appium command driver.PressKeyCode(AndroidKeyCode.Back). Unfortunately nothing happens. I assume the emulator doesn't support the back button in headless mode. If I start the emulator without -no-window then the back button works.

Is there a way to work around this? Running the emulator with UI doesn't seem like a good idea on a CI build.


Solution

  • The back button is available in headless mode. The issue itself was a timing problem - the button was clicked too early and therefore had no effect.