美文网首页
tidevice使用

tidevice使用

作者: i爱吃土豆的猫 | 来源:发表于2023-07-11 09:55 被阅读0次
    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
    

    相关文章

      网友评论

          本文标题:tidevice使用

          本文链接:https://www.haomeiwen.com/subject/zwseudtx.html