用命令行运行airtest会报错wait-for-device

用命令行运行airtest会报错wait-for-device该怎么解决?

C:\Users\Lenovo\Desktop>airtest run 'com.sinyee.babybus.brushteethII.test.cases.724test.air' --device "android:///baa1b086" --log log/
save log in 'log/'
[05:33:18][DEBUG]<airtest.core.android.adb> C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\Lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s baa1b086 wait-for-device
[05:33:19][DEBUG]<airtest.core.android.adb> C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\Lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -s baa1b086 shell getprop ro.build.version.sdk
======================================================================
ERROR: runTest (airtest.cli.runner.AirtestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\site-packages\airtest\cli\runner.py", line 65, in runTest
    with open(pyfilepath, 'r', encoding="utf8") as f:
FileNotFoundError: [Errno 2] No such file or directory: "C:\\Users\\Lenovo\\Desktop\\'com.sinyee.babybus.brushteethII.test.cases.724test.air'"

----------------------------------------------------------------------
Ran 1 test in 0.867s

FAILED (errors=1)

img

这个错误通常是因为Airtest无法找到指定的测试用例文件或设备无法连接导致的。建议您按照以下步骤排查:

确认测试用例文件的路径是否正确,是否存在拼写错误或者路径中包含了特殊字符。在命令行中输入dir命令,查看文件是否存在,并检查文件名是否正确。

确认设备是否已经连接成功,并通过adb devices命令查看设备是否已经连接。

尝试使用命令adb kill-server和adb start-server,重新启动adb服务。

确认是否已经安装了正确的ADB驱动程序,并尝试重新安装ADB驱动程序。

如果您仍然无法解决问题,建议您到Airtest官方论坛中提问,或者查看Airtest的官方文档和示例,寻找更详细的解决方案。