如何在Mac上獲取App Store上的ipa用於ios下的appium 自動化測試


如今很多人想要獲取到App Store上的包卻苦於無奈,先在要把App Store上的包載下來獲取ipa,最直接的就是從手機設備上導出了,但是手機必須要9.0以下才可以導出,鄙人手中正好有公司的測試機,系統是8.1·8.5的幾台,所以做起來方便。最近看到好多朋友也在苦惱,畢竟不是誰都有8.x的機子哈哈哈。下面給大家推薦一個工具用來獲取ipa!!!(Apple Configurator 2)

 

1、首先 去Mac上的App Store下載Apple Configurator 2。然后把iphone連接上Mac,點擊Apple Configurator 2 菜單中->賬戶->登陸(用連接設備的Apple ID)[如果擔心設備數據會丟失,就備份下數據]

 

 

 

2、所有設備->1 選中當前iPhone->2 添加-> 3 應用,找到您想要ipa的那個應用->添加

 

 

 

3、添加后會顯示如下圖片表示正在下載App Store上的應用

 

 

當你的設備上存在這個應用的時候會有如下提示:

 

 

這個時候切記,不要點擊任何按鈕!不要點擊任何按鈕!不要點擊任何按鈕!(重要的事情說三遍)直接進入第四步!

4、打開Finder前往文件夾,或者直接快捷鍵command+shift+G並輸入下面路徑
~/Library/Group Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps/


可以看到我們需要的包,這個時候拷貝出來(一定要拷貝出來),然后回到第三步點擊【停止】會發現剛才目錄下的文件也消失了!

 copy緩存中的IPA包到其他的目錄

 點擊停止內容消失

 


5、拿到包后,可以用IPA做ios的自動化測試

 

#!/usr/bin/env python
# -*-coding:utf-8-*=


import os
import unittest
from appium import webdriver
from time import sleep


class TestSample(unittest.TestCase):
def setUp(self):

self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities=
{
"automationName": "XCUITest",
"platformName": "iOS",
"deviceName": "iPhone 7",
"platformVersion": "12.0",
"app": "/Users/qiuyunxia/yunxia.qiu/code/IPA/test.ipa",
"bundleId": "com.mobvista.ui.test",
"noReset": True,
"udid": "2264c37ef756e8a3c3339097f92a420ed8656375"
}
)

def tearDown(self):

self.driver.quit()

def testSample(self):
sleep(2)
ir = self.driver.find_element_by_name("InterActive Ad")
print(ir.text)
print(ir.tag_name)
try:
self.driver.find_element_by_name("InterActive Ad").click()
sleep(3)
self.driver.get_screenshot_as_file('screen.png')
except:
print("no element")

pass

# def testSample01(self):
# pass


if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestSample)
unittest.TextTestRunner(verbosity=2).run(suite)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM