Appium_Java运行测试脚本时问题汇总

问题一、
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.SessionNotFoundException
解决方法:
pom文件中只配置java-clientJ即可,把selenium相关的配置都移除
问题二、
运行appium-doctor提示需要安装opencv4nodejs,命令为: npm i -g opencv4nodejs
参考地址:https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
问题三、
Message: An unknown server-side error occurred while processing the command. Original error: zipAlignApk failed. Original error: Command 'android-sdk-windows_r24.3.2\\build-tools\\28.0.3\\zipalign.exe -f 4 nodejs\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-debug-androidTest.apk Local\\Temp\\2019023-21080-1lyy0jl.0z4j\\appium.tmp' exited with code 1. Stdout: ''; Stderr: 'Unable to open 'nodejs\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' as zip archive
处理方法:
把nodejs->node_modules下的appium-uiautomator2-driver跟server都删除了,把appium下node_modules下的appium-uiautomator2-driver跟server也都删除了,此时命令行启动appium会提示缺少appium-uiautomator2-driver,于是在nodejs->node_modules->appium->node_modules下再次安装appium-uiautomator2-driver,执行完成后再次运行脚本出现问题四;
实际原因为appium-uiautomator2-server未安装正确;
问题四:
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: this.adb.getApplicationInstallState is not a function
参考: https://github.com/appium/appium/issues/12061
命令行启动appium未解决此问题,安装Appium 桌面版本,此问题解决,同时Appium 在android 8.0上切换Activity无法识别元素的问题也解决了;
问题五:
opencv4nodejs安装
解决方法: https://blog.csdn.net/qq_37385726/article/details/80448322
问题六、
org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl, gradle 5上会报此错误;
android studio 3.2,gradle 4.10.3
解决方法:
Android Studio->Settings->Build,Execution,Deployment->Gradle -> Use local Gradle 选择4.10.3就可以了
参考:https://github.com/gradle/gradle/issues/8088
问题七:
若直接安装Appium desktop版本1.10.1,使用Uiautomator2没有问题,则可以i把桌面版本的node-modules复制到终端安装的appium对应目录下,此时终端安装的appium可以正常使用Uiautomator2了;

 

转载于:https://www.cnblogs.com/jiguanghover/p/10218048.html

你可能感兴趣的:(测试,java,人工智能)