Robotframework 中的多个设备连接错误

Multiple devices connected error in Robotframework

我正在使用带有 UI-Automator 的 Robot Framework 来自动化本机 Android 应用程序。 在我当前的实例中,我将两台设备连接到我的 PC - 一台用于我的一般测试工作,在第二台设备中,我是 运行 Automation。我在 运行 测试用例的同时给出了设备的序列号。

但我在控制台中收到以下错误:

EnvironmentError: Multiple devices attached but default android serial not set

谁能帮我做我需要做的事情。

答案在 Set Serial 关键字的文档中,在 uiautomatorlibrary.html 上,如下:

Set Serial android_serial

Specify given android_serial device to perform test.

You do not have to specify the device when there is only one device connects to the computer.

When you need to use multiple devices, do not use this keyword to switch between devices in test execution.

Using different library name when importing this library according to http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.8.5.

| Setting |..Value.| ..... Value ..... | . Value . |
| Library | Mobile | WITH NAME | Mobile1 |
| Library | Mobile | WITH NAME | Mobile1 |

And set the serial to each library.
| .... Test Case .... | ........ Action ........ | ..... Argument ..... |
| Multiple Devices | Mobile1.Set Serial | device_1's serial |
| .......................... | Mobile2.Set Serial | device_2's serial |