Appium服务器运行python,未检测到通过wifi连接的设备

!
image|800x450
脚本没问题,通过有线可运行,通过无线不可运行报错显示Could not find a connected Android device.

试试这个

还是不行耶

华为手机需要切换手机的工程模式,默认的是模式是断线就关闭,你得开启google或者默认模式。

网传的一部分进入工程模式的方法

华为HUAWEI:*#*#2846579#*#*
三星Samsung:*#0*#
索尼Sony:*#*#7378423#*#*
酷派:*#*#4636#*#*
小米Xiaomi:*#*#6484#*#*
宏碁Acer:*#*#3646633#*#*
华硕ASUS:*#*#4636#*#*
Google NEXUS:*#*#4636#*#*
宏达电HTC:*#*#4636#*#*
富可视Infocus:*#*#3646633#*#*
乐金LG:3845#*802#
OPPO:*#*#4636#*#*
联发科芯片手机:`##3646633#*#

你好,感谢百忙之中的回复。

你的意思是手机需要进入工程模式才能用appium wifi连接手机是吧。
我用的是三星手机,进入工程模式后是测试一些led mic模块什么的,还是不行

[info] e[35m[Appium]e[39m Welcome to Appium v1.13.0
[info] e[35m[Appium]e[39m Non-default server args:
[info] e[35m[Appium]e[39m address: 127.0.0.1
[info] e[35m[Appium]e[39m Appium REST http interface listener started on 127.0.0.1:4723[info] e[35m[HTTP]e[39m e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m
[info] e[35m[HTTP]e[39m e[90m{“capabilities”:{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“9”,“appium:deviceName”:“10.10.21.160:5555”,“appium:automationName”:“Appium”,“appium:appPackage”:“com.autelrobotics.explorer”,“appium:appActivity”:“com.autel.modelb.view.launch.SplashActivity”,“appium:noReset”:true}]},“desiredCapabilities”:{“platformName”:“Android”,“platformVersion”:“9”,“deviceName”:“10.10.21.160:5555”,“automationName”:“Appium”,“appPackage”:“com.autelrobotics.explorer”,“appActivity”:“com.autel.modelb.view.launch.SplashActivity”,“noReset”:true}}e[39m
[debug] e[35m[W3C]e[39m Calling AppiumDriver.createSession() with args: [{“platformName”:“Android”,“platformVersion”:“9”,“deviceName”:“10.10.21.160:5555”,“automationName”:“Appium”,“appPackage”:“com.autelrobotics.explorer”,“appActivity”:“com.autel.modelb.view.launch.SplashActivity”,“noReset”:true},null,{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“9”,“appium:deviceName”:“10.10.21.160:5555”,“appium:automationName”:“Appium”,“appium:appPackage”:“com.autelrobotics.explorer”,“appium:appActivity”:“com.autel.modelb.view.launch.SplashActivity”,“appium:noReset”:true}]}]
[debug] e[35m[BaseDriver]e[39m Event ‘newSessionRequested’ logged at 1604366840439 (09:27:20 GMT+0800 (CST))
[warn] e[35m[Appium]e[39m
[warn] e[35m[Appium]e[39m ======================================================================
[warn] e[35m[Appium]e[39m DEPRECATION WARNING:
[warn] e[35m[Appium]e[39m
[warn] e[35m[Appium]e[39m The ‘automationName’ capability was not provided in the desired
[warn] e[35m[Appium]e[39m capabilities for this Android session
[warn] e[35m[Appium]e[39m
[warn] e[35m[Appium]e[39m Setting ‘automationName=UiAutomator1’ by default and using the
[warn] e[35m[Appium]e[39m UiAutomator1 Driver
[warn] e[35m[Appium]e[39m
[warn] e[35m[Appium]e[39m The next minor version of Appium (1.14.x) will set
[warn] e[35m[Appium]e[39m ‘automationName=UiAutomator2’ by default and use the UiAutomator2
[warn] e[35m[Appium]e[39m Driver
[warn] e[35m[Appium]e[39m
[warn] e[35m[Appium]e[39m The next major version of Appium (2.x) will require the
[warn] e[35m[Appium]e[39m ‘automationName’ capability to be set for all sessions on all
[warn] e[35m[Appium]e[39m platforms
[warn] e[35m[Appium]e[39m
[warn] e[35m[Appium]e[39m If you are happy with ‘UiAutomator1’ and do not wish to upgrade
[warn] e[35m[Appium]e[39m Android drivers, please add ‘automationName=UiAutomator1’ to your
[warn] e[35m[Appium]e[39m desired capabilities
[warn] e[35m[Appium]e[39m
[warn] e[35m[Appium]e[39m For more information about drivers, please visit
[warn] e[35m[Appium]e[39m Introduction - Appium and explore the
[warn] e[35m[Appium]e[39m ‘Drivers’ menu
[warn] e[35m[Appium]e[39m
[warn] e[35m[Appium]e[39m ======================================================================
[warn] e[35m[Appium]e[39m
[info] e[35m[Appium]e[39m Setting automation to ‘UiAutomator1’.
[warn] e[35m[Appium]e[39m Consider setting ‘automationName’ capability to ‘UiAutomator2’ on Android >= 6, since UIAutomator1 framework is not maintained anymore by the OS vendor.
[info] e[35m[Appium]e[39m Appium v1.13.0 creating new AndroidDriver (v4.15.1) session
[info] e[35m[Appium]e[39m Capabilities:
[info] e[35m[Appium]e[39m platformName: Android
[info] e[35m[Appium]e[39m platformVersion: 9
[info] e[35m[Appium]e[39m deviceName: 10.10.21.160:5555
[info] e[35m[Appium]e[39m automationName: Appium
[info] e[35m[Appium]e[39m appPackage: com.autelrobotics.explorer
[info] e[35m[Appium]e[39m appActivity: com.autel.modelb.view.launch.SplashActivity
[info] e[35m[Appium]e[39m noReset: true
[debug] e[35m[BaseDriver]e[39m W3C capabilities {“alwaysMatch”:{“platformNa… and MJSONWP desired capabilities {“platformName”:“Android”,”… were provided
[debug] e[35m[BaseDriver]e[39m Creating session with W3C capabilities: {“alwaysMatch”:{"platformNa…
[info] e[35m[BaseDriver]e[39m Session created with session id: 4f2d88b2-ad85-4bf1-a928-fac94e7c3a25[debug] e[35m[ADB]e[39m 0 device(s) connected
[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[ADB]e[39m Getting connected devices…[debug] e[35m[ADB]e[39m 0 device(s) connected
[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037
[debug] e[35m[ADB]e[39m Getting connected devices…[debug] e[35m[ADB]e[39m 0 device(s) connected
[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[ADB]e[39m Getting connected devices…[debug] e[35m[ADB]e[39m 0 device(s) connected
[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[ADB]e[39m Getting connected devices…[debug] e[35m[ADB]e[39m 0 device(s) connected
[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[ADB]e[39m Getting connected devices…[debug] e[35m[ADB]e[39m 0 device(s) connected
[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037
[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[ADB]e[39m Could not find devices, restarting adb server…
[debug] e[35m[ADB]e[39m Restarting adb
[debug] e[35m[ADB]e[39m Killing adb server on port 5037[debug] e[35m[AndroidDriver]e[39m Shutting down Android driver
[debug] e[35m[AndroidDriver]e[39m Called deleteSession but bootstrap wasn’t active
[debug] e[35m[BaseDriver]e[39m Event ‘newSessionStarted’ logged at 1604366862644 (09:27:42 GMT+0800 (CST))
[debug] e[35m[W3C]e[39m Encountered internal error running command: Error: Could not find a connected Android device.
[debug] e[35m[W3C]e[39m at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/system-calls.js:199:13
[debug] e[35m[W3C]e[39m at Generator.next ()
[debug] e[35m[W3C]e[39m at asyncGeneratorStep (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
[debug] e[35m[W3C]e[39m at _next (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
[debug] e[35m[W3C]e[39m at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
[debug] e[35m[W3C]e[39m at new Promise (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/core-js/modules/es6.promise.js:177:7)
[debug] e[35m[W3C]e[39m at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12
[debug] e[35m[W3C]e[39m at getDevices (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/system-calls.js:197:17)
[debug] e[35m[W3C]e[39m at getDevices (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/system-calls.js:216:20)
[debug] e[35m[W3C]e[39m at Generator.next ()
[debug] e[35m[W3C]e[39m at asyncGeneratorStep (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
[debug] e[35m[W3C]e[39m at _next (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
[debug] e[35m[W3C]e[39m at run (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/core-js/modules/es6.promise.js:75:22)
[debug] e[35m[W3C]e[39m at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/core-js/modules/es6.promise.js:92:30
[debug] e[35m[W3C]e[39m at flush (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/core-js/modules/_microtask.js:18:9)
[debug] e[35m[W3C]e[39m at process._tickCallback (internal/process/next_tick.js:61:11)
[info] e[35m[HTTP]e[39m e[37m<-- POST /wd/hub/session e[39me[31m500e[39m e[90m22267 ms - 714e[39m
[info] e[35m[HTTP]e[39m e[90me[39m

这是appium log


selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not find a connected Android device.

pycharm报错

你adb devices 先查下设备有没有连接上 自己用connect测试 这一步搞不定跑appium是没用的

adb已经连接上的,而且可以使用adb 输入命令打开手机app,脚本也没问题,使用usb连接线时可以打开正常运行python脚本

你用appium log中的执行命令试试,看下报错时执行的那个命令是怎么执行的

The server is running

[Appium] Welcome to Appium v1.13.0

[Appium] Appium REST http interface listener started on 0.0.0.0:4723

[HTTP] --> GET /wd/hub/sessions

[HTTP] {}

[GENERIC] Calling AppiumDriver.getSessions() with args: []

[GENERIC] Responding to client with driver.getSessions() result: []

[HTTP] <-- GET /wd/hub/sessions 200 8 ms - 40

[HTTP]

[HTTP] --> POST /wd/hub/session

[HTTP] {"desiredCapabilities":{"appActivity":"com.autel.modelb.view.launch.SplashActivity","appPackage":"com.autelrobotics.explorer","deviceName":"10.10.21.160:5555","noReset":true,"platformName":"Android","platformVersion":"9","newCommandTimeout":0,"connectHardwareKeyboard":true}}

[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.autel.modelb.view.launch.SplashActivity","appPackage":"com.autelrobotics.explorer","deviceName":"10.10.21.160:5555","noReset":true,"platformName":"Android","platformVersion":"9","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]

[BaseDriver] Event 'newSessionRequested' logged at 1604653136043 (16:58:56 GMT+0800 (CST))

[Appium]

[Appium] ======================================================================

[Appium] DEPRECATION WARNING:

[Appium]

[Appium] The 'automationName' capability was not provided in the desired

[Appium] capabilities for this Android session

[Appium]

[Appium] Setting 'automationName=UiAutomator1' by default and using the

[Appium] UiAutomator1 Driver

[Appium]

[Appium] The next minor version of Appium (1.14.x) will set

[Appium] 'automationName=UiAutomator2' by default and use the UiAutomator2

[Appium] Driver

[Appium]

[Appium] The next major version of Appium (2.x) will **require** the

[Appium] 'automationName' capability to be set for all sessions on all

[Appium] platforms

[Appium]

[Appium] If you are happy with 'UiAutomator1' and do not wish to upgrade

[Appium] Android drivers, please add 'automationName=UiAutomator1' to your

[Appium] desired capabilities

[Appium]

[Appium] For more information about drivers, please visit

[Appium] http://appium.io/docs/en/about-appium/intro/ and explore the

[Appium] 'Drivers' menu

[Appium]

[Appium] ======================================================================

[Appium]

[Appium] Setting automation to 'UiAutomator1'.

[Appium] Consider setting 'automationName' capability to 'UiAutomator2' on Android >= 6, since UIAutomator1 framework is not maintained anymore by the OS vendor.

[Appium] Appium v1.13.0 creating new AndroidDriver (v4.15.1) session

[Appium] Capabilities:

[Appium] appActivity: com.autel.modelb.view.launch.SplashActivity

[Appium] appPackage: com.autelrobotics.explorer

[Appium] deviceName: 10.10.21.160:5555

[Appium] noReset: true

[Appium] platformName: Android

[Appium] platformVersion: 9

[Appium] newCommandTimeout: 0

[Appium] connectHardwareKeyboard: true

[BaseDriver] Creating session with MJSONWP desired capabilities: {"appActivity":"com.autel.m...

[BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.

[BaseDriver] Session created with session id: f4d8b0d2-1df5-4c2c-9bb2-90a483615744

[ADB] Found 1 'build-tools' folders under '/Users/autel/Library/Android/sdk' (newest first):

[ADB] /Users/autel/Library/Android/sdk/build-tools/28.0.3

[ADB] Using 'adb' from '/Users/autel/Library/Android/sdk/platform-tools/adb'

[AndroidDriver] Retrieving device list

[ADB] Trying to find a connected android device

[ADB] Getting connected devices...

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices...

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices...

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices...

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices...

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Getting connected devices...

[ADB] 0 device(s) connected

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[ADB] Could not find devices, restarting adb server...

[ADB] Restarting adb

[ADB] Killing adb server on port 5037

[AndroidDriver] Shutting down Android driver

[AndroidDriver] Called deleteSession but bootstrap wasn't active

[BaseDriver] Event 'newSessionStarted' logged at 1604653158345 (16:59:18 GMT+0800 (CST))

[MJSONWP] Encountered internal error running command: Error: Could not find a connected Android device.

[MJSONWP] at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/system-calls.js:199:13

[MJSONWP] at Generator.next ()

[MJSONWP] at asyncGeneratorStep (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)

[MJSONWP] at _next (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

[MJSONWP] at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7

[MJSONWP] at new Promise (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/core-js/modules/es6.promise.js:177:7)

[MJSONWP] at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12

[MJSONWP] at getDevices (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/system-calls.js:197:17)

[MJSONWP] at getDevices (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/system-calls.js:216:20)

[MJSONWP] at Generator.next ()

[MJSONWP] at asyncGeneratorStep (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)

[MJSONWP] at _next (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

[MJSONWP] at run (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/core-js/modules/es6.promise.js:75:22)

[MJSONWP] at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/core-js/modules/es6.promise.js:92:30

[MJSONWP] at flush (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/core-js/modules/_microtask.js:18:9)

[MJSONWP] at process._tickCallback (internal/process/next_tick.js:61:11)

[HTTP] <-- POST /wd/hub/session 500 22363 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 7 ms - 57

[HTTP]

不太懂 你是说这个log吗

appium -g appium.log 用这个log,会打印的更详细

在哪输入这个指令