我们需要手动启动 Appium 的 Android 模拟器吗? [英] Do we need to manually start the Android emulator for Appium?

查看:29
本文介绍了我们需要手动启动 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?

推荐答案

在您的设置中启用Launch 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");

这篇关于我们需要手动启动 Appium 的 Android 模拟器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆