Can I run appium in headless mode?

Can I run appium in headless mode? Automating for android native app.

Its exactly the same way as “normal” mode. The appium part doesn’t really change anything. You just need to launch emulator in headless mode, something like

emulator -avd test_headless -no-audio -no-window &
1 Like

How about running iOS native app in headless mode? Can anyone pls let me know if this is possible

Where you need to execute the above command?

In Windows command line prompt?

If Yes, do i need to specify the emulator name? In the above command what is the emulator name?

Hi,

yes, thats in windows command line prompt :slight_smile: You need to have paths properly set in order to access emulator from any folder.

For more information about emulator just write:

emulator -help

More info in here: http://paulemtz.blogspot.pt/2013/05/android-testing-in-headless-emulator.html

Howdy,
I hope this helps someone. I’ve been messing with this for a while today…

First, assuming you have Appium installed and adb[.exe] is in your path…

  1. Start Appium as you normally do (I haven’t found a way to do this without having Appium running)

  2. from the command line, run: emulator -list-avds
    The results will be something like this (depending on which emulators you have configured):
    Nexus_5X_API_29
    Pixel_2_API_29
    Pixel_3a_API_29

  3. run: emulator -avd Pixel_3a_API_29 -no-audio -no-window &
    Note that I chose Pixel_3a_API_29 as the emulator I want to use

  4. Your source code that sets the desired capabilities should look something like this:
    this.capabilities = {

    isHeadless: true,

    };

  5. Run your test as normal:
    mocha ./test/myTest-test.js

Your command line window will show you any logged events/stdout, etc… Any screenshots you capture will actually work! Provided that nobody snuck in an XPath change this time, you should be good-to-go!

Good luck. Stay safe and COVID-free!

Hi, when I run the above command I am getting PANIC: Missing emulator engine program for ‘x86’ CPU. error. How to fix this? Thanks

Hello, this is probably because your host is a 64bit operational system which doesn’t accept 32bit applications. In my case I had this issue because I use macOS Catalina. So if this your situation too, you need create a new emulator on Android Studio and choosing the x86_64 system image.