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了;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM