1.JDK安裝與配置
略
2.Android Studio+Android SDK安裝與配置
略
3.安裝node。
1.用brew install node谐算,也可以到官網(wǎng)下載
brew安裝node遇到的一些問(wèn)題記錄
問(wèn)題一:Error: node: Failed to download resource "openssl@1.1"
貌似網(wǎng)絡(luò)問(wèn)題又沾,又進(jìn)行brew install node 遇到了問(wèn)題二
問(wèn)題二: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 遇到了問(wèn)題三
問(wèn)題三: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
問(wèn)題四: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后好了
驗(yàn)證node是否安裝成功
4.安裝appium
1)安裝Appium服務(wù)
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) 安裝桌面版弊仪,可以到官網(wǎng)下載https://appium.io/熙卡,可能比較慢,也還可以接受
3)安裝Appium-doctor進(jìn)行檢測(cè)
sudo npm install -g appium-doctor
5.android元素定位UIautomatorview(也有其他定位方法)
UIautomatorviewer報(bào)錯(cuò)空指針
解決參考https://blog.csdn.net/weixin_40233077/article/details/124069469
6.安裝python的appium開(kāi)發(fā)包
pip3 install appium-python-client
demo嘗試
import time
from appium.webdriver import Remote #引入打開(kāi)軟件的包
#安裝励饵,如果已安裝卸載后安裝新包
#app的啟動(dòng)參數(shù)
desired_cap={
"platformName":"Android", #手機(jī)系統(tǒng)
"platformVersion": "11", #手機(jī)系統(tǒng)版本
"deviceName":"Redmi Note 9", #手機(jī)的名字驳癌,不會(huì)進(jìn)行校驗(yàn),但是沒(méi)有會(huì)報(bào)錯(cuò)
#"automationName":"UiAutomator2",#自動(dòng)化測(cè)試框架 (1.4以上的appium不用寫)
"appPackage":"com.packagename",#app包名
"appActivity":"yourlaunch-activity",#app的啟動(dòng)頁(yè)面
}
driver = Remote(command_executor='http://127.0.0.1:4723/wd/hub',desired_capabilities=desired_cap)
print("啟動(dòng)開(kāi)始時(shí)間:"+str(time.time()))
driver.find_element("id","android:id/button2").click()
driver.find_element("xpath",r'//android.widget.FrameLayout[@content-desc="文本"]').click()
driver.quit()