安裝
http://www.itdecent.cn/p/eec62494a5b0
使用前注意
-
測(cè)試App在真機(jī)上調(diào)試滿足以下幾點(diǎn):
1.設(shè)置>開發(fā)者>Enable UI Automation 打開;
2.源碼導(dǎo)入Xcode;
3.需要developer證書并且將測(cè)試機(jī)的udid 加入到pp(Provisioning Profile)文件,configruation為debug;
- 編譯打包到終端;
注:2?4不會(huì)要可以找IOS開發(fā)人員幫助,本寶寶也是找開發(fā)解決的。
5.工程中終端配置啟動(dòng)項(xiàng)
-
WebdriverAgent版本問題
1、1.7.2 Appium Desktop
需要替換 node_modules 目錄下的 WebdriverAgent
2、1.8.0 Appium Desktop
不需要,直接將 webdriverAgent 安裝到手機(jī)即可;
python腳本使用Tips
- 模擬器啟動(dòng)基本代碼(運(yùn)行腳本前請(qǐng)先打開Appium服務(wù))
from appium import webdriver
import pandas as pd
import time
desired_caps = {
'deviceName': 'iPhone X', #模擬器名稱
'platformName': 'ios',
'platformVersion': '11.2', #模擬器版本號(hào),不是app的最低版本號(hào)
'bundleId': 'com.galaxyentertainment.crmmobile'
}
# 真機(jī)需要一下這些
# desired_caps['bundleId'] = 'com.galaxyentertainment.crmmobile'
# desired_caps['udid'] = 'f37a8a5e786b4ee728961a118591f43d50baa08d'
# desired_caps['xcodeOrgId'] = "填寫你公司的開發(fā)者帳號(hào)"
# desired_caps['xcodeSigningId'] = "iPhone Developer"
# desired_caps['no-reset'] = True
# desired_caps['app'] = "/Users/woody/Downloads/DriverSide.ipa"
driver = webdriver.Remote(command_executor="http://127.0.0.1:4723/wd/hub", desired_capabilities=desired_caps)

腳本運(yùn)行成功自動(dòng)彈出頁面.png
- 演示-輸入文本+點(diǎn)擊按鈕
# 獲取ui控件(根據(jù)type)
# 設(shè)置用戶名+密碼
tfs = driver.find_element_by_class_name('TextField')
# 清空輸入框,注意模擬器需要打開鍵盤彈出功能(cmd+k)
tfs.clear()
tfs.send_keys('ptr.wei.zou')
passwordTF = driver.find_element_by_class_name('XCUIElementTypeSecureTextField')
passwordTF.clear()
passwordTF.send_keys('Abcd12346!@#')
# 登錄
driver.find_element_by_name('Login').click()