使用Appium Desktop遇到的一些坑

1. appium-desktop安装时采用选择了all user, 之后执行脚本时,执行到

webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)

会出现以下错误

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not sign with default certificate. Original error Command ''C:\\Program Files\\Java\\jdk1.8.0_60\\bin\\java.exe' -jar 'C:\\Program Files (x86)\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-adb\\jars\\sign.jar' 'C:\\Program Files (x86)\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-v1.18.0.apk' --override' exited with code 1

解决方案:

权限问题, 确保C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\ 有写的权限

 

2. 参数设置self.desired_caps['automationName'] = 'uiautomator2' 会出现以下两种报错而导致无法启动Appium服务

 Got an unexpected response: {"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}
[UiAutomator2] [UIAutomator2] INSTRUMENTATION_STATUS: id=ActivityManagerService
[UiAutomator2] [UIAutomator2] INSTRUMENTATION_STATUS: Error=Permission Denial: starting instrumentation ComponentInfo{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner} from pid=19303, uid=19303 not allowed because package io.appium.uiautomator2.server.test does not have a signature matching the target io.appium.uiautomator2.server
[UiAutomator2] [UIAutomator2] INSTRUMENTATION_STATUS_CODE: -1
[UiAutomator2] [UIAutomator2] java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner} from pid=19303, uid=19303 not allowed because package io.appium.uiautomator2.server.test does not have a signature matching the target io.appium.uiautomator2.server

以上报错是因为 android-sdk-windows\build-tools\2x.0.x中的apksigner.bat不能正常工作。重新下载安装build-tool就可以了

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'D\:\\android\\android-sdk-windows\\sdk\\platform-tools\\adb.exe -P 5037 -s xxxx pull /data/app/com.xxx-1/base.apk C\:\\Users\\xxx\\AppData\\Local\\Temp\\com.xxxx.apk' exited with code 1'; Stderr: 'remote object '/data/app/com.xxx-1/base.apk' does not exist'; Code: '1'

 以上报错不知道具体原因,但是升级到最新的appium版本就不再出现

 

 

 

你可能感兴趣的:(Appium)