是通过命令行方式启动 appium -a 127.0.0.1 -p 4723 -U 序列号 --session-override
不是通过客户端

from appium import webdriver

desired_caps = {
                'platformName': 'Android', 
                'platformVersion': '7.1.2', 
                'deviceName': 'vivo', 
                'appPackage': 'com.android.bbkcalculator',
                'appActivity': '.Calculator',
                "noReset": True,
                'newCommandTimeout': 30,
                "resetKeyboard": True,
                "noSign": True
                }

driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
driver.find_element_by_id('com.android.bbkcalculator:id/digit1').click()
driver.find_element_by_id('com.android.bbkcalculator:id/plus').click()
driver.find_element_by_id('com.android.bbkcalculator:id/digit1').click()
driver.find_element_by_id('com.android.bbkcalculator:id/equal').click()
driver.close_app()

错误信息如下

Unhandled rejection Error: Error executing adbExec. Original error: 'Command 'D:\test\android-sdk\platform-tools\adb.exe -P 5037 -s 2d4fac41 shell input keyevent 3' exited with code 4294967177'; Stderr: ''; Code: '4294967177'
at ADB.execFunc$ (D:\test\nodejs\node_default\node_modules\appium\node_modules\appium-adb\lib\tools\system-calls.js:317:13)
at tryCatch (D:\test\nodejs\node_default\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
at GeneratorFunctionPrototype.invoke (D:\test\nodejs\node_default\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
at

不是很懂新版的 appium
😢


↙↙↙阅读原文可查看相关链接,并与作者交流