Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do we need to manually start the Android emulator for Appium?

I'm new to appium and I'm running the calculator example test using the following code:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","AndroidTestDevice");
capabilities.setCapability("platformName","Android");    
capabilities.setCapability("appPackage", "com.android.calculator2");       
capabilities.setCapability("appActivity","com.android.calculator2.Calculator");
driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);

Appium is running as you can see in the following screenshot:

enter image description here

If the emulator is not running, I get the error related to no devices found. My question is:

Do I need to manually start the emulator every time I need to execute a test? or Does appium will start the android emulator when the test is executed?

enter image description here

like image 511
msiles Avatar asked Jan 07 '16 20:01

msiles


1 Answers

In your settings enable "Launch AVD" and enter the name of the Android Virtual Device you created. This will start the emulator (if it's not already started) whenever you start a test.

Update:

You need to set the AVD capability. Simply add this line to your code capabilities.setCapability("avd","AndroidTestDevice");

like image 94
econoMichael Avatar answered Sep 22 '22 03:09

econoMichael