tidevice使用

https://github.com/alibaba/taobao-iphone-device
http://www.manongjc.com/detail/60-cyzzpycghszyfxe.html

安装 使用 手机配置 查看版本号 配对 列出连接设备 应用管理 Run XCTest Relay 运行WebDriverAgent 运行XCTest UITest 挂载开发者镜像

安装

pip3 install -U "tidevice[openssl]"

xxx@izhangdeMacBook-Pro ~ % pip3 install -U "tidevice[openssl]"
Collecting tidevice[openssl]
  Using cached tidevice-0.10.9-py3-none-any.whl (92 kB)
Collecting Pillow
  Downloading Pillow-10.0.0-cp311-cp311-macosx_10_10_x86_64.whl (3.4 MB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 341.9 kB/s eta 0:00:00
Collecting requests
  Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Collecting colored
  Downloading colored-2.2.2-py3-none-any.whl (16 kB)
Collecting packaging
  Using cached packaging-23.1-py3-none-any.whl (48 kB)
Collecting tornado
  Downloading tornado-6.3.2-cp38-abi3-macosx_10_9_x86_64.whl (422 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 422.6/422.6 kB 192.2 kB/s eta 0:00:00
Collecting simple-tornado>=0.2.2
  Using cached simple_tornado-0.2.2-py3-none-any.whl (3.3 kB)
Collecting retry
  Downloading retry-0.9.2-py2.py3-none-any.whl (8.0 kB)
Collecting simplejson
  Downloading simplejson-3.19.1-cp311-cp311-macosx_10_9_x86_64.whl (75 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.5/75.5 kB 165.6 kB/s eta 0:00:00
Collecting tabulate
  Using cached tabulate-0.9.0-py3-none-any.whl (35 kB)
Collecting logzero
  Downloading logzero-1.7.0-py2.py3-none-any.whl (16 kB)
Collecting loguru
  Downloading loguru-0.7.0-py3-none-any.whl (59 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.0/60.0 kB 200.5 kB/s eta 0:00:00
Collecting deprecation
  Downloading deprecation-2.1.0-py2.py3-none-any.whl (11 kB)
Collecting urllib3<2
  Downloading urllib3-1.26.16-py2.py3-none-any.whl (143 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.1/143.1 kB 195.7 kB/s eta 0:00:00
Collecting pyOpenSSL
  Downloading pyOpenSSL-23.2.0-py3-none-any.whl (59 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.0/59.0 kB 210.9 kB/s eta 0:00:00
Collecting pyasn1
  Downloading pyasn1-0.5.0-py2.py3-none-any.whl (83 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.9/83.9 kB 199.4 kB/s eta 0:00:00
Collecting cryptography!=40.0.0,!=40.0.1,<42,>=38.0.0
  Downloading cryptography-41.0.1-cp37-abi3-macosx_10_12_x86_64.whl (2.8 MB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 171.1 kB/s eta 0:00:00
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.2.0-cp311-cp311-macosx_10_9_x86_64.whl (125 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.1/125.1 kB 139.1 kB/s eta 0:00:00
Collecting idna<4,>=2.5
  Downloading idna-3.4-py3-none-any.whl (61 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 146.3 kB/s eta 0:00:00
Collecting certifi>=2017.4.17
  Downloading certifi-2023.5.7-py3-none-any.whl (156 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 157.0/157.0 kB 113.8 kB/s eta 0:00:00
Collecting decorator>=3.4.2
  Downloading decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting py<2.0.0,>=1.4.26
  Downloading py-1.11.0-py2.py3-none-any.whl (98 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.7/98.7 kB 113.1 kB/s eta 0:00:00
Collecting cffi>=1.12
  Downloading cffi-1.15.1-cp311-cp311-macosx_10_9_x86_64.whl (179 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 179.2/179.2 kB 107.0 kB/s eta 0:00:00
Collecting pycparser
  Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 kB 115.5 kB/s eta 0:00:00
Installing collected packages: logzero, urllib3, tornado, tabulate, simplejson, pycparser, pyasn1, py, Pillow, packaging, loguru, idna, decorator, colored, charset-normalizer, certifi, simple-tornado, retry, requests, deprecation, cffi, tidevice, cryptography, pyOpenSSL
Successfully installed Pillow-10.0.0 certifi-2023.5.7 cffi-1.15.1 charset-normalizer-3.2.0 colored-2.2.2 cryptography-41.0.1 decorator-5.1.1 deprecation-2.1.0 idna-3.4 loguru-0.7.0 logzero-1.7.0 packaging-23.1 py-1.11.0 pyOpenSSL-23.2.0 pyasn1-0.5.0 pycparser-2.21 requests-2.31.0 retry-0.9.2 simple-tornado-0.2.2 simplejson-3.19.1 tabulate-0.9.0 tidevice-0.10.9 tornado-6.3.2 urllib3-1.26.16

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: python3.11 -m pip install --upgrade pip

查看版本

tidevice version

xxxx@izhangdeMacBook-Pro ~ % tidevice version                   
tidevice version 0.10.9

查看设备信息

tidevice info
xxx@izhangdeMacBook-Pro ~ % tidevice info
MarketName:       iPhone 6s Plus
DeviceName:       6SP-13.4-64-禁止升级
ProductVersion:   13.4
ProductType:      iPhone8,2
ModelNumber:      MKVV2
SerialNumber:     C39QFU6JGRWV
PhoneNumber:      None
CPUArchitecture:  arm64
ProductName:      iPhone OS
ProtocolVersion:  2
RegionInfo:       LL/A
TimeIntervalSince1970: 1689041768.451943
TimeZone:         America/Los_Angeles
UniqueDeviceID:   407fcb77509bd47e05d8b8edcd3ce3790bb5c9d7
WiFiAddress:      fc:fc:48:a6:32:e0
BluetoothAddress: fc:fc:48:a6:32:e1
BasebandVersion:  7.51.01

tidevice info --json
xxx@izhangdeMacBook-Pro ~ % tidevice info --json
{
    "ActivationState": "Activated",
    "ActivationStateAcknowledged": true,
    "BasebandActivationTicketVersion": "V2",
    "BasebandCertId": 3840149528,
    "BasebandChipID": 9572577,
    "BasebandKeyHashInformation": {
    "AKeyStatus": 2,
    "SKeyHash": "u+/tcCwvaQ+1Y9t40I4yegCEmB28mALlaROhaIVGBWo=",
    "SKeyStatus": 0
},
"BasebandMasterKeyHash": "8CB15EE4C8002199070D9500BB8FB183B02713A5CA2A6B92DB5E75CE15536182",
"BasebandRegionSKU": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"BasebandSerialNumber": "BSaUDQ==",
"BasebandStatus": "BBInfoAvailable",
"BasebandVersion": "7.51.01",
"BluetoothAddress": "fc:fc:48:a6:32:e1",
"BoardId": 6,
"BrickState": false,
"BuildVersion": "17E255",
"CPUArchitecture": "arm64",
"CarrierBundleInfoArray": [
    {
        "CFBundleIdentifier": "com.apple.CMCC_cn",
        "CFBundleVersion": "41.0",
        "GID1": "ffffffff",
        "GID2": "ffffffff",
        "IntegratedCircuitCardIdentity": "898600c00119f0133572",
        "InternationalMobileSubscriberIdentity": "460022010477585",
        "MCC": "460",
        "MNC": "02",
        "MobileEquipmentIdentifier": "35329207068675",
        "Slot": "kOne",
        "kCTPostponementInfoAvailable": "SIMCarrierInfo"
    }
],
"CertID": 3840149528,
"ChipID": 32768,
"ChipSerialNo": "BSaUDQ==",
"DeviceClass": "iPhone",
"DeviceColor": "#272728",
"DeviceName": "6SP-13.4-64-禁止升级",
"DieID": 3538223366188,
"EthernetAddress": "fc:fc:48:a6:32:e2",
"FirmwareVersion": "iBoot-5540.102.4",
"FusingStatus": 3,
"HardwareModel": "N66AP",
"HardwarePlatform": "s8000",
"HasSiDP": true,
"HostAttached": true,
"InternationalMobileEquipmentIdentity": "353292070686759",
"MLBSerialNumber": "C0753761K9VG35WA",
"MobileEquipmentIdentifier": "35329207068675",
"MobileSubscriberCountryCode": "460",
"MobileSubscriberNetworkCode": "",
"ModelNumber": "MKVV2",
"NonVolatileRAM": {
    "auto-boot": "dHJ1ZQ==",
    "backlight-level": "MTUyNA==",
    "boot-args": "",
    "com.apple.System.boot-nonce": "0x3ab1efa457dfa01a",
    "com.apple.System.fp-state": "AAAAAD8AAAAAAAAAAAAAAAAAAAA=",
    "com.apple.System.tz0-size": "MHhFMDAwMDA=",
    "nonce-seeds": "AAAAAAAAAAC3SLEsbbW5TgQKOt9EROwjAAAAAAAAAADfupBw9UT679DuaxkMtM8cAAAAAAAAAAA7WjFYMyJhVU7f9deWB60JAAAAAAAAAACQXE7LN+jDHqFOJKTjetc0",
    "oblit-begins": "T2JsaXRUeXBlOiBPYmxpdGVyYXRlRGF0YVBhcnRpdGlvbi4gUmVhc29uOiB1bmtub3du",
    "obliteration": "aGFuZGxlX21lc3NhZ2U6IE9ibGl0ZXJhdGlvbiBDb21wbGV0ZQo="
},
"PartitionType": "GUID_partition_scheme",
"PasswordProtected": false,
"PkHash": "5OQIGNymupBn16zMKPujMp3562XDnNFkULy+gshbERM=",
"ProductName": "iPhone OS",
"ProductType": "iPhone8,2",
"ProductVersion": "13.4",
"ProductionSOC": true,
"ProtocolVersion": "2",
"ProximitySensorCalibration": "T00EAA0KQzgQA7wCsAS5ALwCTAACAKO+QgMDAKaY9QLuAkYAhPeRATKvqRsAAAAA4QCVAAECAABFAAAAAAAAAAAAAAAAAAAA",
"RegionInfo": "LL/A",
"SIMStatus": "kCTSIMSupportSIMStatusNotInserted",
"SIMTrayStatus": "kCTSIMSupportSIMTrayInsertedNoSIM",
"SerialNumber": "C39QFU6JGRWV",
"SoftwareBehavior": "EQAAAAAAAAAAAAAAAAAAAA==",
"SoftwareBundleVersion": "",
"SupportedDeviceFamilies": [
    1
],
"TelephonyCapability": true,
"TimeIntervalSince1970": 1689041882.43672,
"TimeZone": "America/Los_Angeles",
"TimeZoneOffsetFromUTC": -25200.0,
"TrustedHostAttached": true,
"UniqueChipID": 3538223366188,
"UniqueDeviceID": "407fcb77509bd47e05d8b8edcd3ce3790bb5c9d7",
"UseRaptorCerts": true,
"Uses24HourClock": true,
"WiFiAddress": "fc:fc:48:a6:32:e0",
"WirelessBoardSerialNumber": "571F6BF006C",
"kCTPostponementInfoPRLName": 0,
"kCTPostponementStatus": "kCTPostponementStatusActivated"
}

查看电池信息

xxx@izhangdeMacBook-Pro ~ % tidevice info --domain     com.apple.mobile.battery --json
{
"BatteryCurrentCapacity": 100,
"BatteryIsCharging": false,
"ExternalChargeCapable": false,
"ExternalConnected": true,
"FullyCharged": true,
"GasGaugeCapability": true,
"HasBattery": true
}

配对功能

tidevice pair
xxxx@izhangdeMacBook-Pro ~ % tidevice pair
Paired with device 530a0f8ebb699738d605e68a5c8e54b0a4bcd925 HostID: 651A4458-9D29-4AFF-92C3-CD020D17CDDB

tidevice unpair

列出设备

tidevice list

xxx@izhangdeMacBook-Pro ~ % tidevice list
UDID                                      SerialNumber    NAME              
MarketName        ProductVersion  ConnType
407fcb77509bd47e05d8b8edcd3ce3790bb5c9d7  C39QFU6JGRWV    6SP-13.4-64-禁止升级  iPhone 6s Plus              13.4  ConnectionType.USB

tidevice list --json

xxx@izhangdeMacBook-Pro ~ % tidevice list --json
[
   {
    "udid": "407fcb77509bd47e05d8b8edcd3ce3790bb5c9d7",
    "serial": "C39QFU6JGRWV",
    "name": "6SP-13.4-64-禁止升级",
    "market_name": "iPhone 6s Plus",
    "product_version": "13.4",
    "conn_type": "usb"
   }
]

安装应用

tidevice install

xxx@izhangdeMacBook-Pro ~ % tidevice install /Users/xxx/Desktop/01提示语\ 2022-06-29\ 11-26-34/Apps/01提示语.ipa 
Copying '/Users/xxx/Desktop/01提示语 2022-06-29 11-26-34/Apps/01提示语.ipa' to device... [10.6 MB/s 0s] DONE.         
Installing 'com.dumpapp.testdev1000' '1.0'
- CreatingStagingDirectory (5%)
- ExtractingPackage (15%)
- InspectingPackage (20%)
- TakingInstallLock (20%)
- PreflightingApplication (30%)
- InstallingEmbeddedProfile (30%)
- VerifyingApplication (40%)
- CreatingContainer (50%)
- InstallingApplication (60%)
- PostflightingApplication (70%)
- SandboxingApplication (80%)
- GeneratingApplicationMap (90%)
Complete
xxx@izhangdeMacBook-Pro ~ % 


tidevice --udid 

卸载应用

tidevice uninstall  com.example.demo(包名,bundleId)

启动应用

tidevice launch com.example.demo(包名,bundleId)

停止应用

tidevice kill com.example.demo(包名,bundleId)

查看已经安装的应用

tidevice applist

查看运行中的应用

tidevice ps

xxx@izhangdeMacBook-Pro ~ % tidevice ps
PID NAME                              BUNDLE_ID               DISPLAY_NAME
85460 WeChat                            com.tencent.xin         微信         
84660 com.sogou.sogouinput.BaseKeyboard                                    
85099 Spotlight                         com.apple.Spotlight     Siri搜索     
85290 EscrowSecurityAlert                                                  
85120 Siri                              com.apple.siri          Siri       
85413 Preferences                       com.apple.Preferences   设置         
85408 PPMobilePlatformDemo              com.dumpapp.testdev2    PPMobileApp
85519 01提示语                    

tidevice ps --json

xxx@izhangdeMacBook-Pro ~ % tidevice ps --json
[
{
    "pid": 85460,
    "name": "WeChat",
    "bundle_id": "com.tencent.xin",
    "display_name": "微信"
},
{
    "pid": 84660,
    "name": "com.sogou.sogouinput.BaseKeyboard",
    "bundle_id": "",
    "display_name": ""
},
{
    "pid": 85099,
    "name": "Spotlight",
    "bundle_id": "com.apple.Spotlight",
    "display_name": "Siri搜索"
},
{
    "pid": 85290,
    "name": "EscrowSecurityAlert",
    "bundle_id": "",
    "display_name": ""
},
{
    "pid": 85120,
    "name": "Siri",
    "bundle_id": "com.apple.siri",
    "display_name": "Siri"
},
{
    "pid": 85413,
    "name": "Preferences",
    "bundle_id": "com.apple.Preferences",
    "display_name": "设置"
},
{
    "pid": 85408,
    "name": "PPMobilePlatformDemo",
    "bundle_id": "com.dumpapp.testdev2",
    "display_name": "PPMobileApp"
},
{
    "pid": 85519,
    "name": "01提示语",
    "bundle_id": "com.dumpapp.testdev1000",
    "display_name": "测试的App名字"
},
{
    "pid": 84870,
    "name": "MailCacheDeleteExtension",
    "bundle_id": "",
    "display_name": ""
}
]
xxx@izhangdeMacBook-Pro ~ % 

Run XCTest

请先确保手机上已经安装有WebDriverAgent应用

tidevice xctest -B  com.testtools.xctrunner
tidevice xctest -B  com.testtools.xctrunner -e USB_PORT:8200 --debug

文件操作

tidevice fsync ls  /DCIM/

查看性能数据

tidevice perf -B com.beeasy.shopee.id.enterprise -o fps
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,569评论 4 363
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,499评论 1 294
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,271评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,087评论 0 209
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,474评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,670评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,911评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,636评论 0 202
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,397评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,607评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,093评论 1 261
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,418评论 2 254
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,074评论 3 237
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,092评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,865评论 0 196
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,726评论 2 276
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,627评论 2 270

推荐阅读更多精彩内容