Skip to content

Latest commit

 

History

History
154 lines (119 loc) · 4.1 KB

README_EN.md

File metadata and controls

154 lines (119 loc) · 4.1 KB

tidevice

tidevice

PyPI PyPI - Downloads

中文文档

Command line tool to communicate with iOS device, support the following functions

  • screenshot
  • get device info
  • ipa install and uninstall
  • launch and kill app
  • list installed app info
  • retrieve performance data
  • simulate run xctest, eg: WebDriverAgent
  • other

Support platform: Mac, Linux, Windows

Install

Python 3.7+

pip3 install -U tidevice

Usage

Show version number

$ tidevice version
0.1.0

List connected devices

$ tidevice list
List of apple devices attached
00008030-001A35E40212345678 codeskyblue的iPhoneSE

$ tidevice list --json
[
    {
        "udid": "00008030-001A35E40212345678",
        "name": "codeskyblue的iPhoneSE"
    }
]

App management

$ tidevice install example.ipa

# Specify device udid to install
$ tidevice --udid $UDID install https://example.org/example.ipa

$ tidevice uninstall com.example.demo

$ tidevice launch com.example.demo

$ tidevice kill com.example.demo

# show installed app list
$ tidevice applist

Run XCTest

Please make sure your iPhone already have WebDriverAgent installed

$ tidevice xctest -B com.facebook.wda.WebDriverAgent.Runner
[I 210127 11:40:23 _device:909] BundleID: com.facebook.wda.WebDriverAgent.Runner
[I 210127 11:40:23 _device:911] DeviceIdentifier: 12345678901234567890abcdefg
[I 210127 11:40:23 _device:773] SignIdentity: 'Apple Development: -Your-Developer-Name-'
[I 210127 11:40:23 _device:840] Launch 'com.facebook.wda.WebDriverAgent.Runner' pid: 239
[I 210127 11:40:23 _device:1003] ProductVersion: 12.4
[I 210127 11:40:24 _device:952] Start execute test plan with IDE version: 29
[I 210127 11:40:24 _device:875] WebDriverAgent start successfully

# Change WDA listen port to 8200
$ tidevice xctest -B com.facebook.wda.WebDriverAgent.Runner -e USB_PORT:8200

Relay

# proxy local tcp request to phone, alternative: iproxy
$ tidevice relay 8100 8100

# relay and show traffic data with hexdump
$ tidevice relay -x 8100 8100

Run WebDriverAgent

command:wdaproxy invoke xctest and relay, with watchers to keep xctest always running

# 运行 XCTest 并在PC上监听8200端口转发到手机8100服务
$ tidevice wdaproxy -B com.facebook.wda.WebDriverAgent.Runner --port 8200
...logs...

Then you can connect with Appium or facebook-wda

facebook-wda example code

import wda
c = wda.Client("http://localhost:8200")
print(c.info)

Mount DeveloperDiskImage

# Find in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
# If not found, download from https://github.com/iGhibli/iOS-DeviceSupport
$ tidevice developer
[I 210127 11:37:52 _device:518] ProductVersion: 12.4
[I 210127 11:37:52 _imagemounter:81] Pushing DeveloperDiskImage.dmg
[I 210127 11:37:52 _imagemounter:94] Push complete
[I 210127 11:37:53 _device:589] DeveloperImage mounted successfully

Other

# reboot device
$ tidevice reboot

$ tidevice screenshot screenshot.jpg

# TODO(ssx): collect performance
# $ tidevice perf -o fps,mem,cpu -B com.example.demo

# same as idevicesyslog
$ tidevice syslog

DEVELOP

See DEVELOP

Thanks

LICENSE

MIT