Appium DeskTop连接模拟器(真机)测试报错Could not find a connected Android device
程序员文章站
2022-03-22 13:15:04
...
一、问题描述
测试小白,学习自动化测试,连接夜神模拟,真机也试过了,同样报错,这是问题是迄今为止我遇到最der(东北话)的问题,网上百度五花八门,全都是屁话,测试论坛发帖无人回复,真的跪了。我今天把自己的解决方法分享出来,希望帮到大家。
描述如下
[ADB] Could not find devices, restarting adb server...
[ADB] Restarting adb
[ADB] Killing adb server on port 5037
[ADB] Running 'D:\Sets\Android\android-sdk\platform-tools\adb.exe -P 5037 kill-server'
[ADB] Could not find devices, restarting adb server...
[ADB] Restarting adb
[ADB] Killing adb server on port 5037
[ADB] Running 'D:\Sets\Android\android-sdk\platform-tools\adb.exe -P 5037 kill-server'
[ADB] Could not find devices, restarting adb server...
[ADB] Restarting adb
[ADB] Killing adb server on port 5037
[ADB] Running 'D:\Sets\Android\android-sdk\platform-tools\adb.exe -P 5037 kill-server'
[UiAutomator2] Deleting UiAutomator2 session
[BaseDriver] Event 'newSessionStarted' logged at 1577948298976 (14:58:18 GMT+0800 (中国标准时间))
[MJSONWP] Encountered internal error running command: Error: Could not find a connected Android device.
[MJSONWP] at getDevices (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-android-driver\node_modules\appium-adb\lib\tools\system-calls.js:203:13)
[MJSONWP] at getDevices (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-android-driver\node_modules\appium-adb\lib\tools\system-calls.js:220:20)
[HTTP] <-- POST /wd/hub/session 500 37991 ms - 179
[HTTP]
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- DELETE /wd/hub/session 404 2 ms - 57
[HTTP]
二、解决办法
这个问题网上找,真的,真的,很普遍,但你肯能使用的所有解决方法都没法解决问题,我说说我的解决办法
1、以管理员身份进入Windows PowerShell,输入以下命令
62001 为第一个夜神模拟器的端口号
62005 为第二个
62006 第三个,以此类推
adb connect 127.0.0.1:62001
输入adb devices
出现显示127.0.0.1:62001 device,说明连接成功
2、右键管理员身份启动Appium,启动服务,启动Session,成功!!!!!!