Airtest是一個基於圖像識別的UI自動化平臺
1.下載並編譯iOS-target
ios-target基於webdriver,並對適用airtest進行了定製,並刪除了不必要的內容。
下載地址
我下載的是ios-target_master.zip文件,解壓後將文件夾重命名爲ios_target
2.用xcode打開這個文件夾,然後用類似wda的編譯方法,連接手機到mac,
3.修改target中的配置,這裏需要改動的內容有兩個,1)在signing中選擇開發者的team,
2)在target-info中找到Bundle Identifier,並進行修改
上圖中的id需要自定義個,常規做法是在Runner後加一些自己的內容(例如target,因爲私人開發者有id數量限制,建議每修改一次id,在筆記中做下記錄)
4.在xcode中編譯
product
->Scheme
->WebDriverAgentRunner
product
->Destination
-> iphone(這個是我自己的手機)
然後product-test運行,這是會在手機上裝一個webdriveragentrunner-runner的沒有圖標的應用
5.連接手機到Airtest
1)安裝libimobiledevices
brew install libimobiledevice
2)iproxy 8100 8100
3)在xcode中
顯示debug Area,並在調試信息中查看手機的ip,ServerURLHere->http://xxx.xxx.xxx.xxx:port<-ServerURLHere,拿到ip之後在瀏覽器輸入http://ip:port/status(這裏有個問題Could not load IOSurface for time string. Rendering locally instead
)解決方法可以參考https://www.jianshu.com/p/ccc4a12a253c?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
6.inspector
看到這個界面說明連接成功了,試下inspector
7.因爲airtest默認不支持像安卓那樣實時顯示屏幕所以要下載wdaproxy
https://github.com/openatx/wdaproxy
8.安裝wdaproxy
從名字看是一個wda的代理
brew install openatx/tap/wdaproxy
9.獲取手機uuid,通過itunes可以查看到uuid
然後運行
wdrproxy -p 8100 -u +上文中的uuid
10.在AirtestIDE 中iOScontent的輸入框中輸入步驟5中的ip+端口,點擊content,
以上就是Airtest連接iOS的配置,歡迎加我好友一起討論。