Appium安装 Appium环境配置(包括Mac 版本 、Windows版本)
推荐版本:
- appium 1.15.1
- JDK:1.8
- tools:28-29
appium提示: INSTALL_PARSE_FAILED_NO_CERTIFICATES
解决方法:
新增启动app参数:‘automationName’ = ‘UiAutomator1’
appium提示:Error starting Appium server:listen EADDRINUSE 0.0.0.0.4723
解决方法:
因4723端口被占用,更换端口启动即可
appium提示:Original error: Could not find ‘aapt’ in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the corect Android SDK root directory path.
解决方法:配置环境变量ANDROID_HOME,配置至sdk根目录下
通过appium启动手机自带浏览器,报错:
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error getting device API level. Original error: Error executing adbExec. Original error: ‘Command ‘C:\software\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 127.0.0.1:7555 shell getprop ro.build.version.sdk’ timed out after 20000ms’. Try to increase the 20000ms adb execution timeout represented by ‘adbExecTimeout’ capability
解决方法:本地chromedriver版本与手机内浏览器版本不匹配,下载对应版本即可
chromedriver下载 chromedriver下载地址与webview自动化关键代码
mumu模拟器已启动,但adb device无信息
解决方法:
【win版】
adb connect 127.0.0.1:7555
adb shell
【mac版】
adb kill-server && adb server && adb shell
启动appium报错:error: uncaughtException: primordials is not defined date=Thu Jul 23 2020 14:00:40 GMT+0800 (GMT+08:00)
解决方法:检查appium、node、java版本
appium -v
node -v
java -version
安装匹配的版本
推荐appium1.15.1、node12、java1.8
appium日志内报错:
annot use apksigner tool for signature verification. Original error: Command '/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/home/bin/java -Xmx1024M -Xss1m -jar /Users/xxx/Library/Android/sdk/build-tools/30.0.1/lib/apksigner.jar verify --print-certs /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v4.5.5.apk' exited with code 1
[ADB] Defaulting to verify.jar
解决方法:
卸载build tools 30 版本,安装28或者29版本
原因:build tools 30版本需要jdk1.8以上版本才能编译
appium日志报错:
Stderr: 'java.lang.SecurityException: Permission Denial: starting Intent
解决办法:
-
adb shell am start -n 包名/activity #检查现有activity是否可启动app
- demo:adb shell am start -n com.tencent.wework/.launch.LaunchSplashActivity
-
adb logcat |grep -i ‘activitymanager’ 检查activity是否正确
appium报错
An unknown server-side error occurred while processing the command. Original error; Cannot read property toLowerCase' of undefined
解决办法:
- 检查Capabilities参数拼写,上述错误是因为platformName对应参数拼写有误
appium报错:Locator Strategy ‘css selector’ is not supported for this session
解决方法:
-
selenium是将浏览器原生的API封装成WebDriver API ,webdriver 是基于 http协议的;
appium是 webdriver 协议添加对移动设备自动化api扩展而成的,基于tcp/ip协议(使用了socket接口); -
因此在使用webdriver时要注意引用来源:
-
web自动化: from selenium import webdriver
-
app自动化: from appium import webdriver