1.JDK安装与配置
略
2.Android Studio+Android SDK安装与配置
略
3.安装node。
1.用brew install node,也可以到官网下载
brew安装node遇到的一些问题记录
问题一:Error: node: Failed to download resource "openssl@1.1"
貌似网络问题,又进行brew install node 遇到了问题二
问题二:Error: No such file or directory @ rb_sysopen - /Users/BB/Library/Caches/Homebrew/downloads/fe012f6dfe2107d5847036d09831accbe834fe941a0dbc1f43f761d481620747--libnghttp2-1.49.0.arm64_monterey.bottle.tar.gz
解决:export HOMEBREW_BOTTLE_DOMAIN=''
后重新brew install node 遇到了问题三
问题三:Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew
).
解决:export HOMEBREW_NO_INSTALL_CLEANUP=TRUE后
brew install node
问题四:npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
added 360 packages in 10s
11 packages are looking for funding
run npm fund
for details
npm fund后好了
验证node是否安装成功
4.安装appium
1)安装Appium服务
npm install -g appium
npm install -g appium-doctor
上面慢
切换源
npm config set registry https://registry.npm.taobao.org
npm install -g appium@1.19.1
2) 安装桌面版,可以到官网下载https://appium.io/,可能比较慢,也还可以接受
3)安装Appium-doctor进行检测
sudo npm install -g appium-doctor
5.android元素定位UIautomatorview(也有其他定位方法)
UIautomatorviewer报错空指针
解决参考https://blog.csdn.net/weixin_40233077/article/details/124069469
6.安装python的appium开发包
pip3 install appium-python-client
demo尝试
import time
from appium.webdriver import Remote #引入打开软件的包
#安装,如果已安装卸载后安装新包
#app的启动参数
desired_cap={
"platformName":"Android", #手机系统
"platformVersion": "11", #手机系统版本
"deviceName":"Redmi Note 9", #手机的名字,不会进行校验,但是没有会报错
#"automationName":"UiAutomator2",#自动化测试框架 (1.4以上的appium不用写)
"appPackage":"com.packagename",#app包名
"appActivity":"yourlaunch-activity",#app的启动页面
}
driver = Remote(command_executor='http://127.0.0.1:4723/wd/hub',desired_capabilities=desired_cap)
print("启动开始时间:"+str(time.time()))
driver.find_element("id","android:id/button2").click()
driver.find_element("xpath",r'//android.widget.FrameLayout[@content-desc="文本"]').click()
driver.quit()