我们需要手动启动Appium的Android模拟器吗?

我们需要手动启动Appium的Android模拟器吗?

问题描述:

我是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正在运行,如以下屏幕截图所示:

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

如果仿真器未运行,则会收到与找不到任何设备相关的错误. 我的问题是:

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

每次执行测试时都需要手动启动仿真器吗?或执行测试时,appium是否会启动android仿真器?

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?

在您的设置中启用启动AVD"并输入您创建的Android虚拟设备的名称.每当您开始测试时,这都会启动模拟器(如果尚未启动).

更新:

您需要设置AVD功能.只需将此行添加到您的代码capabilities.setCapability("avd","AndroidTestDevice");

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