Coder Social home page Coder Social logo

taobao-iphone-device's Introduction

tidevice

tidevice

Github action status PyPI PyPI - Downloads

iOS17的支持通知

本来想自己实现iOS17的支持,但是发现自己没这个实力,不过社区还是很强大的,目前发现了一个好项目能支持iOS17: pymobiledevice3,这个项目的代码写的非常好,因为太过优秀,我就不继续在tidevice里面去实现了。不过这个项目的命令行好像不太友好,所以我又搞了一个新项目

https://github.com/codeskyblue/tidevice3

基于pymobiledevice3做封装,封装了一些常用的功能,如app install uninstall screenshot。欢迎体验

English

QQ交流群: 134535547 (进群答案: 自己猜吧,不行就问gpt)

该工具能够用于与iOS设备进行通信, 提供以下功能

  • 截图
  • 获取手机信息
  • ipa包的安装和卸载
  • 根据bundleID 启动和停止应用
  • 列出安装应用信息
  • 模拟Xcode运行XCTest,常用的如启动WebDriverAgent测试(此方法不依赖xcodebuild)
  • 获取指定应用性能(CPU,MEM,FPS)
  • 获取指定应用功耗(CPU,GPU,network,display,location)
  • 文件操作
  • Crash日志操作
  • 其他

支持运行在Mac,Linux,Windows上

赞助商

霍格沃兹测试开发学社

霍格沃兹测试开发学社:**软件测试开发高端教育品牌,产品由国内顶尖软件测试开发技术专家携手打造。为企业与个人提供专业的技能培训与咨询、测试工具与测试平台、测试外包与测试众包服务。领域涵盖App/Web自动化测试、接口自动化测试、性能测试、安全测试、持续交付/DevOps、测试左移、测试右移、精准测试、测试平台开发、测试管理等方向,联系我们

安装

Python 3.6+

pip3 install -U "tidevice[openssl]"   # Recommend

如果上面的命令提示安装失败,就试试下面的命令。(不过这种方法安装,配对功能就没有了,因为没有办法进行签名)

pip3 install -U tidevice

Windows电脑需要安装并启动Itunes

使用

使用--trace选项可以查看socket数据流

手机配置

iOS 16的手机需要手工开启开发者选项。 开启方法:设置->隐私与安全性->开发者模式 (打开),然后会提示重启 (点击 重新启动) -> 启动后会弹窗 是否打开“开发者模式”?(点击打开)

查看版本号

$ tidevice version
0.1.0

配对

$ tidevice pair
# 配对设备

$ tidevice unpair
# 取消配对设备

列出连接设备

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

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

应用管理

# 安装应用
$ tidevice install example.ipa

# 指定设备安装
$ tidevice --udid $UDID install https://example.org/example.ipa

# 卸载应用
$ tidevice uninstall com.example.demo

# 启动应用
$ tidevice launch com.example.demo

# 停止应用
$ tidevice kill com.example.demo

# 查看已安装应用
$ tidevice applist

# 查看运行中的应用
$ tidevice ps
$ tidevice ps --json output as json

Run XCTest

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

# 运行XCTEST
$ tidevice xcuitest -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

# 修改监听端口为8200, 并显示调试日志
$ tidevice xcuitest -B com.facebook.wda.WebDriverAgent.Runner -e USE_PORT:8200 --debug

Relay

# 转发请求到手机,类似于iproxy
$ tidevice relay 8100 8100

# 转发并把传输的内容用hexdump的方法print出来
$ tidevice relay -x 8100 8100

运行WebDriverAgent

目前已知的几个问题

wdaproxy这个命令会同时调用xctest和relay,另外当wda退出时,会自动重新启动xctest

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

启动后你就可以使用Appium 或者 facebook-wda 来运行iOS自动化了

facebook-wda example code

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

Appium 需要下面几个配置需要设置一下

"usePrebuiltWDA": "false",
"useXctestrunFile": "false",
"skipLogCapture": "true"

需要在Windows上运行Appium+iOS自动化可以参考下面的帖子 https://testerhome.com/topics/29230 Ref issue #46

运行XCTest UITest

这个不是Unit Tests,而是UITests。具体可以看这里的解释说明 https://fbidb.io/docs/test-execution

以这个项目为例: https://github.com/FeiHuang93/XCTest-Demo 应用分为执行测试的应用 testXCTestUITests 和 被测应用 testXCTest

执行方法

$ tidevice xcuitest --bundle-id philhuang.testXCTestUITests.xctrunner --target-bundle-id philhuang.testXCTest
# ... 省略一部分不重要的信息 ...
[I 210301 15:37:07 _device:887] logProcess: 2021-03-01 15:37:07.924620+0800 testXCTestUITests-Runner[81644:13765443] Running tests...
[I 210301 15:37:07 _device:984] Test runner ready detected
[I 210301 15:37:07 _device:976] Start execute test plan with IDE version: 29
[I 210301 15:37:07 _device:887] logProcess: Test Suite 'All tests' started at 2021-03-01 15:37:08.009
    XCTestOutputBarrier
[I 210301 15:37:07 _device:887] logProcess: Test Suite 'testXCTestUITests.xctest' started at 2021-03-01 15:37:08.010
    XCTestOutputBarrierTest Suite 'testXCTestUITests' started at 2021-03-01 15:37:08.010
[I 210301 15:37:07 _device:887] logProcess: XCTestOutputBarrier
[I 210301 15:37:07 _device:887] logProcess: Test Case '-[testXCTestUITests testExample]' started.
    XCTestOutputBarrier
[I 210301 15:37:07 _device:887] logProcess:     t =     0.00s Start Test at 2021-03-01 15:37:08.010
[I 210301 15:37:07 _device:887] logProcess:     t =     0.00s Set Up
[I 210301 15:37:07 _device:887] logProcess: 2021-03-01 15:37:08.010828+0800 testXCTestUITests-Runner[81644:13765443] testExample start
[I 210301 15:37:07 _device:887] logProcess:     t =     0.00s     Open philhuang.testXCTest
[I 210301 15:37:07 _device:887] logProcess:     t =     0.00s         Launch philhuang.testXCTest
[I 210301 15:37:08 _device:887] logProcess:     t =     0.04s             Wait for accessibility to load
[I 210301 15:37:08 _device:887] logProcess:     t =     0.04s             Setting up automation session
[I 210301 15:37:08 _device:887] logProcess:     t =     0.10s             Wait for philhuang.testXCTest to idle
[I 210301 15:37:09 _device:887] logProcess:     t =     1.13s Tear Down
[I 210301 15:37:09 _device:887] logProcess: Test Case '-[testXCTestUITests testExample]' passed (1.337 seconds).
[I 210301 15:37:09 _device:887] logProcess: XCTestOutputBarrier
[I 210301 15:37:09 _device:887] logProcess: Test Suite 'testXCTestUITests' passed at 2021-03-01 15:37:09.349.
    	 Executed 1 test, with 0 failures (0 unexpected) in 1.337 (1.339) seconds
    XCTestOutputBarrier
[I 210301 15:37:09 _device:887] logProcess: Test Suite 'testXCTestUITests.xctest' passed at 2021-03-01 15:37:09.350.
    	 Executed 1 test, with 0 failures (0 unexpected) in 1.337 (1.340) seconds
[I 210301 15:37:09 _device:887] logProcess: XCTestOutputBarrier
[I 210301 15:37:09 _device:887] logProcess: Test Suite 'All tests' passed at 2021-03-01 15:37:09.352.
    	 Executed 1 test, with 0 failures (0 unexpected) in 1.337 (1.343) seconds
    XCTestOutputBarrier
[I 210301 15:37:09 _device:887] logProcess: XCTestOutputBarrier
[I 210301 15:37:09 _device:1059] xctrunner quited

挂载开发者镜像

这个步骤其实不太需要,因为如果tidevice的命令需要开发者镜像的时候,会自动去挂载的

# 先在本地路径查找 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
# 如果没有会去网站 https://github.com/iGhibli/iOS-DeviceSupport 下载,下载到路径 ~/.tidevice/device-support/
$ 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

# 下载所有镜像到本地
$ tidevice developer --download-all

查看设备信息

$ tidevice info

# 查看设备电源信息
$ tidevice info --domain com.apple.mobile.battery --json
{
    "BatteryCurrentCapacity": 53,
    "BatteryIsCharging": true,
    "ExternalChargeCapable": true,
    "ExternalConnected": true,
    "FullyCharged": false,
    "GasGaugeCapability": true,
    "HasBattery": true
}

Known domains are:

com.apple.disk_usage
com.apple.disk_usage.factory
com.apple.mobile.battery
com.apple.iqagent
com.apple.purplebuddy
com.apple.PurpleBuddy
com.apple.mobile.chaperone
com.apple.mobile.third_party_termination
com.apple.mobile.lockdownd
com.apple.mobile.lockdown_cache
com.apple.xcode.developerdomain
com.apple.international
com.apple.mobile.data_sync
com.apple.mobile.tethered_sync
com.apple.mobile.mobile_application_usage
com.apple.mobile.backup
com.apple.mobile.nikita
com.apple.mobile.restriction
com.apple.mobile.user_preferences
com.apple.mobile.sync_data_class
com.apple.mobile.software_behavior
com.apple.mobile.iTunes.SQLMusicLibraryPostProcessCommands
com.apple.mobile.iTunes.accessories
com.apple.mobile.internal
com.apple.mobile.wireless_lockdown
com.apple.fairplay
com.apple.iTunes
com.apple.mobile.iTunes.store
com.apple.mobile.iTunes

文件操作

# 查看相册内容
$ tidevice fsync /DCIM/

# 查看T3出行Documents中的内容
$ tidevice fsync -B com.t3go.passenger ls /Documents/

# 下载目录(也支持文件)
$ tidevice pull /Documents ./TmpDocuments/

# 其他操作 rm cat pull push stat tree rmtree mkdir
$ tidevice fsync -h

# 支持查看 /Documents 的App
# com.apple.iMovie iMovie
# com.apple.mobilegarageband 库乐队
# com.apple.clips 可立拍
# com.t3go.passenger T3出行
# com.dji.golite DJI Fly
# com.duokan.reader 多看阅读

Crash日志操作

usage: tidevice crashreport [-h] [--list] [--keep] [--clear] [output_directory]

positional arguments:
  output_directory  The output dir to save crash logs synced from device (default: None)

optional arguments:
  -h, --help        show this help message and exit
  --list            list all crash files (default: False)
  --keep            copy but do not remove crash reports from device (default: False)
  --clear           clear crash files (default: False)

其他常用

# 重启
$ tidevice reboot

# 截图
$ tidevice screenshot screenshot.jpg

# 输出日志 same as idevicesyslog
$ tidevice syslog

性能采集

使用命令行可以直接看到结果,不过最好还是用接口获取

# 性能采集
$ tidevice perf -B com.example.demo --json

cpu {"timestamp": 1671173334888, "pid": 18717, "value": 0.0, "sys_value": 53.26736370425692, "count": 6}
memory {"pid": 18717, "timestamp": 1671173334888, "value": 10.20428466796875}
gpu {"device": 0, "renderer": 0, "tiler": 0, "value": 0, "timestamp": 1671173331745}
fps {"fps": 0, "value": 0, "timestamp": 1671173331745}
network {"connection-detected": {"Local": "[fe80::5cd8:6aff:fe80:78c3]:54658", "Remote": "[::]:0", "InterfaceIndex": 10, "Pid": -2, "RecvBufferSize": 131072, "RecvBufferUsed": 0, "SerialNumber": 14, "Protocol": "tcp6"}, "timestamp": 1671173331756}
network {"interface-detection": {"InterfaceIndex": 10, "Name": "anpi0"}, "timestamp": 1671173331767}
network {"interface-detection": {"InterfaceIndex": 14, "Name": "en0"}, "timestamp": 1671173331767}
network {"connection-update": {"RxPackets": 2, "RxBytes": 72, "TxPackets": 3, "TxBytes": 163, "RxDups": null, "RxOOO": null, "TxRetx": null, "MinRTT": 0.039375, "AvgRTT": 0.042, "ConnectionSerial": 56, "Time": 2}, "timestamp": 1671173335754}
...
# 功耗采集
# 每一秒打印一行JSON,至于里面什么单位不太懂
$ tidevice energy com.example.demo
{"energy.overhead": 490.0, "kIDEGaugeSecondsSinceInitialQueryKey": 1209, "energy.version": 1, "energy.gpu.cost": 0, "energy.cpu.cost": 62.15080582703523, "energy.networkning.overhead": 500, "energy.appstate.cost": 8, "energy.location.overhead": 0, "energy.thermalstate.cost": 0, "energy.networking.cost": 501.341030606293, "energy.cost": 767.8212481980341, "energy.display.cost": 214.3294117647059, "energy.cpu.overhead": 0, "energy.location.cost": 0, "energy.gpu.overhead": 0, "energy.appstate.overhead": 0, "energy.display.overhead": 0, "energy.inducedthermalstate.cost": -1}

How to get app performance in python

import time
import tidevice
from tidevice._perf import DataType

t = tidevice.Device()
perf = tidevice.Performance(t, [DataType.CPU, DataType.MEMORY, DataType.NETWORK, DataType.FPS, DataType.PAGE, DataType.SCREENSHOT, DataType.GPU])
#  tidevice version <= 0.4.16:
#  perf = tidevice.Performance(t)

def callback(_type: tidevice.DataType, value: dict):
    print("R:", _type.value, value)


perf.start("com.apple.Preferences", callback=callback)
time.sleep(10)
perf.stop()

DEVELOP

See DEVELOP

Python code style(ZH): https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_style_rules/#comments

Alternatives

Thanks

LICENSE

MIT

taobao-iphone-device's People

Contributors

373743261 avatar alibaba-oss avatar codeskyblue avatar dhiravidamani238 avatar douniwan5788 avatar electricbubble avatar fanjlii avatar huang1988519 avatar jaskyer avatar litmanenpl avatar litonggao avatar lubrau avatar mhaoli avatar nanoscopic avatar pengchenglin avatar qiudaomao avatar steelonion avatar vdavdev avatar yaming116 avatar yanbo92 avatar youngfreefjs avatar zer0e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taobao-iphone-device's Issues

连线的时候有机率出现断线的情况, 请问一下我该如何处理?

我在连线的时候遇到了一些问题, 当我使用facebook-wda运行tidevice时,
有机率出现断线的情况, 请问一下我该如何处理?

  • device:iphone12 mini
  • iOS:14.4
  • xcode:12.4

[I 210309 13:21:00 _device:887] logProcess: t = 1907.73s Find: Identity Binding
[I 210309 13:21:00 _device:887] logProcess: t = 1907.74s Check for interrupting elements affecting "inputAccount" Other
[I 210309 13:21:00 _device:887] logProcess: t = 1907.74s Requesting snapshot of accessibility hierarchy for app with pid 1808
[I 210309 13:21:00 _device:1059] xctrunner quited

facebook-wda:
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

无法创建Session,Unexpected end of file from server

系统:macOS Big Sur(11.2.3)
手机:iPhone 12 Pro Max(14.4.1)
创建Session时提示Unexpected end of file from server
wda显示的日志:

[D 210317 22:46:10 _relay:36] handle stream from: ('::1', 50265, 0, 0)
[D 210317 22:56:18 _relay:36] handle stream from: ('127.0.0.1', 50619)
[D 210317 22:56:46 _wdaproxy:91] [00008101] WDA is not response, check again after 10s
[I 210317 22:56:59 _wdaproxy:95] [00008101] WDA confirmed not running
[I 210317 22:56:59 _wdaproxy:104] [00008101] WDA keeper stopped
[I 210317 22:56:59 _wdaproxy:132] [00008101] WDA stopped for the 5st time, running 11.8 minutes
[D 210317 22:56:59 _wdaproxy:116] [00008101] launch WDA

找不到iOS14.4.zip文件

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://tool.appetizer.io/iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4.zip
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://github.com/iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4.zip
自动webdriverrunner时报找不到文件,下载地址里面没有对应文件,但是里面的iOS14文件名包含其他的内容,我感觉你们时没有测iOS14的设备?
https://tool.appetizer.io/iGhibli/iOS-DeviceSupport/tree/master/DeviceSupport

http://localhost:8100/inspecto 無法使用

tidevice wdaproxy -B com.facebook.wda.WebDriverAgent.Runner --port 8100 送出後,可以正常使用 facebook-wda
但開啟"http://localhost:8100/inspecto" 無法顯示UI圖層
{
"value" : {
"error" : "unknown command",
"message" : "Unhandled endpoint: /inspector -- http://localhost:8100/ with parameters {\n wildcards = (\n inspector\n );\n}",
"traceback" : ""
},
"sessionId" : "9B60EDE7-2C28-4F4B-9222-67B13EB8865F"
}
或者是否有其他方式可以檢視UI圖層呢?感謝

可以直接驱动原生的XCUITest么

不喜欢WDA这种东西,原生的速度和稳定性我感觉也很棒,就是apple推出的基于swift和OC的这些ui自动化
不晓得tidevice能否驱动呢?
感谢
image

Launch and Browse

Hi,

Is there a way for tidevice launch to launch safari and browse a site immediately? I tried "tidevice launch com.apple.mobilesafari ['-u', 'https://github.com/']" and "tidevice launch com.apple.mobilesafari ['https://github.com/']", they both launch safari but they do not browse the given site.

求助 - tidevice运行过程中崩溃,提示dtxm socket closed 不知道是什么原因

环境mac【打算用windows的,所以先用mac试一试】 + python3.8 + tidevic 0.3.3 + pytest + allure + facebook-wda 1.3.3

问题描述:
我们写的自动化case,启动tidevice之后,case正常运行,但是大概率情况下,运行10 - 30分钟,tidevce崩溃,之前用xcode启动wda的时候,很少很少会这样

求助,我想知道是我们的代码影响到了tidevie服务了嘛?或者哪些情况下可能影响到tidevice服务?还是因为企业证书,我们使用的这个里面教程,强行写死,使xcode编译用用企业证书【https://github.com/appium/appium/issues/13086#issuecomment-559488669】
感谢各位大佬解答,再次感谢

tidevice退出截图
image

tidevice.exceptions.MuxError: socket unix:/var/run/usbmuxd unable to connect

在 Ubuntu 上执行 tidevice list 会报异常

系统:5.4.0-60-generic #67~18.04.1-Ubuntu
具体日志:
List of apple devices attached
Traceback (most recent call last):
File "/root/.pyenv/versions/3.8.0/bin/tidevice", line 10, in
sys.exit(main())
File "/root/.pyenv/versions/3.8.0/lib/python3.8/site-packages/tidevice/main.py", line 407, in main
actionsargs.subparser
File "/root/.pyenv/versions/3.8.0/lib/python3.8/site-packages/tidevice/main.py", line 81, in cmd_list
for dinfo in um.device_list():
File "/root/.pyenv/versions/3.8.0/lib/python3.8/site-packages/tidevice/_usbmux.py", line 72, in device_list
data = self.send_recv(payload)
File "/root/.pyenv/versions/3.8.0/lib/python3.8/site-packages/tidevice/_usbmux.py", line 45, in send_recv
with self.create_connection() as s:
File "/root/.pyenv/versions/3.8.0/lib/python3.8/site-packages/tidevice/_usbmux.py", line 42, in create_connection
return PlistSocket(self.__address, self._next_tag())
File "/root/.pyenv/versions/3.8.0/lib/python3.8/site-packages/tidevice/_safe_socket.py", line 89, in init
super().init(addr)
File "/root/.pyenv/versions/3.8.0/lib/python3.8/site-packages/tidevice/_safe_socket.py", line 44, in init
raise MuxError("socket unix:{} unable to connect".format(addr))
tidevice.exceptions.MuxError: socket unix:/var/run/usbmuxd unable to connect

重签名的wda启动报错,在mac上用xcode可以正常进行自动化

手机上的wda是重签名,目前在mac上可以正常运行自动化,win10上启动就报错,
启动命令:

tidevice wdaproxy -B com.qdm.WebDriverAgentRunner.xctrunner --port 8200

报错信息如下:

[D 210218 09:22:43 _wdaproxy:116] [2bdd9c5129393d4f0a3e209af99a212732e659a6] launch WDA
[I 210218 09:22:45 _device:917] BundleID: com.qdm.WebDriverAgentRunner.xctrunner
[I 210218 09:22:45 _device:919] DeviceIdentifier: 2bdd9c5129393d4f0a3e209af99a212732e659a6
[I 210218 09:22:45 _device:517] ProductVersion: 14.4
[I 210218 09:22:45 _device:496] Download https://tool.appetizer.io/iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4(FromXcode_12.4(12D4e)).zip -> C:\Users\linkage\.tidevice\device-support\14.4.zip
Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 399, in start_service
    return self._unsafe_start_service(name)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 414, in _unsafe_start_service
    raise MuxServiceError("Could not start service: {0}! {2}".format(
tidevice.exceptions.MuxServiceError: Could not start service: com.apple.testmanagerd.lockdown.secure! Remember that you have to mount the Developer disk image on your device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connection.py", line 496, in _connect_tls_proxy
    return ssl_wrap_socket(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\ssl.py", line 1040, in _create
    self.do_handshake()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\util\retry.py", line 573, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='tool.appetizer.io', port=443): Max retries exceeded with url: /iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4(FromXcode_12.4(12D4e)).zip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\__main__.py", line 488, in <module>
    main()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\__main__.py", line 483, in main
    actions[args.subparser](args)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\__main__.py", line 210, in cmd_xctest
    d.xctest(args.bundle_id, logger=setup_logger(level=logging.INFO), env=env)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 929, in xctest
    x1 = self._connect_testmanagerd_lockdown()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 741, in _connect_testmanagerd_lockdown
    conn = self.start_service(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 401, in start_service
    self.mount_developer_image()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 585, in mount_developer_image
    with self._request_developer_image_dir() as _dir: #, signature_path:
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 550, in _request_developer_image_dir
    self._urlretrieve(mirror_url, image_zip_path)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 500, in _urlretrieve
    with requests.get(url, stream=True) as r:
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='tool.appetizer.io', port=443): Max retries exceeded with url: /iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4(FromXcode_12.4(12D4e)).zip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)')))
[E 210218 09:22:46 _wdaproxy:124] [2bdd9c5129393d4f0a3e209af99a212732e659a6] wda started failed
[D 210218 09:22:46 _wdaproxy:116] [2bdd9c5129393d4f0a3e209af99a212732e659a6] launch WDA
[I 210218 09:22:48 _device:917] BundleID: com.qdm.WebDriverAgentRunner.xctrunner
[I 210218 09:22:48 _device:919] DeviceIdentifier: 2bdd9c5129393d4f0a3e209af99a212732e659a6
[I 210218 09:22:49 _device:517] ProductVersion: 14.4
[I 210218 09:22:49 _device:496] Download https://tool.appetizer.io/iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4(FromXcode_12.4(12D4e)).zip -> C:\Users\linkage\.tidevice\device-support\14.4.zip
Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 399, in start_service
    return self._unsafe_start_service(name)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 414, in _unsafe_start_service
    raise MuxServiceError("Could not start service: {0}! {2}".format(
tidevice.exceptions.MuxServiceError: Could not start service: com.apple.testmanagerd.lockdown.secure! Remember that you have to mount the Developer disk image on your device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connection.py", line 496, in _connect_tls_proxy
    return ssl_wrap_socket(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\ssl.py", line 1040, in _create
    self.do_handshake()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\util\retry.py", line 573, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='tool.appetizer.io', port=443): Max retries exceeded with url: /iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4(FromXcode_12.4(12D4e)).zip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\__main__.py", line 488, in <module>
    main()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\__main__.py", line 483, in main
    actions[args.subparser](args)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\__main__.py", line 210, in cmd_xctest
    d.xctest(args.bundle_id, logger=setup_logger(level=logging.INFO), env=env)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 929, in xctest
    x1 = self._connect_testmanagerd_lockdown()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 741, in _connect_testmanagerd_lockdown
    conn = self.start_service(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 401, in start_service
    self.mount_developer_image()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 585, in mount_developer_image
    with self._request_developer_image_dir() as _dir: #, signature_path:
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 550, in _request_developer_image_dir
    self._urlretrieve(mirror_url, image_zip_path)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 500, in _urlretrieve
    with requests.get(url, stream=True) as r:
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='tool.appetizer.io', port=443): Max retries exceeded with url: /iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4(FromXcode_12.4(12D4e)).zip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)')))
[E 210218 09:22:53 _wdaproxy:124] [2bdd9c5129393d4f0a3e209af99a212732e659a6] wda started failed
[D 210218 09:22:53 _wdaproxy:116] [2bdd9c5129393d4f0a3e209af99a212732e659a6] launch WDA
[I 210218 09:22:56 _device:917] BundleID: com.qdm.WebDriverAgentRunner.xctrunner
[I 210218 09:22:56 _device:919] DeviceIdentifier: 2bdd9c5129393d4f0a3e209af99a212732e659a6
[I 210218 09:22:56 _device:517] ProductVersion: 14.4
[I 210218 09:22:56 _device:496] Download https://tool.appetizer.io/iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4(FromXcode_12.4(12D4e)).zip -> C:\Users\linkage\.tidevice\device-support\14.4.zip
Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 399, in start_service
    return self._unsafe_start_service(name)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 414, in _unsafe_start_service
    raise MuxServiceError("Could not start service: {0}! {2}".format(
tidevice.exceptions.MuxServiceError: Could not start service: com.apple.testmanagerd.lockdown.secure! Remember that you have to mount the Developer disk image on your device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connection.py", line 496, in _connect_tls_proxy
    return ssl_wrap_socket(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\ssl.py", line 1040, in _create
    self.do_handshake()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\urllib3\util\retry.py", line 573, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='tool.appetizer.io', port=443): Max retries exceeded with url: /iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4(FromXcode_12.4(12D4e)).zip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\__main__.py", line 488, in <module>
    main()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\__main__.py", line 483, in main
    actions[args.subparser](args)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\__main__.py", line 210, in cmd_xctest
    d.xctest(args.bundle_id, logger=setup_logger(level=logging.INFO), env=env)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 929, in xctest
    x1 = self._connect_testmanagerd_lockdown()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 741, in _connect_testmanagerd_lockdown
    conn = self.start_service(
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 401, in start_service
    self.mount_developer_image()
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 585, in mount_developer_image
    with self._request_developer_image_dir() as _dir: #, signature_path:
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 550, in _request_developer_image_dir
    self._urlretrieve(mirror_url, image_zip_path)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\tidevice\_device.py", line 500, in _urlretrieve
    with requests.get(url, stream=True) as r:
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "c:\users\linkage\appdata\local\programs\python\python38\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='tool.appetizer.io', port=443): Max retries exceeded with url: /iGhibli/iOS-DeviceSupport/raw/master/DeviceSupport/14.4(FromXcode_12.4(12D4e)).zip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)')))
[E 210218 09:22:57 _wdaproxy:124] [2bdd9c5129393d4f0a3e209af99a212732e659a6] wda started failed

查找元素出现connect to device error: UsbmuxReplyCode.ConnectionRefused

请求信息

http://127.0.0.1:8100/session/B1561F07-B790-4D37-9912-BA7BA84BBBFA/elements
{"value":"ADD TO BAG","using":"name"}

问题描述:
连续请求此接口5 6次以上没有返回结果会出现connect to device error: UsbmuxReplyCode.ConnectionRefused,

[E 210208 16:23:40 _relay:46] connect to device error: UsbmuxReplyCode.ConnectionRefused
[I 210208 16:23:41 _device:883] WebDriverAgent start successfully

用relay一直卡着不能转发端口

win10系统,不确认为什么无法用relay去转发端口,之前用linux,iproxy是正常的。
这个是系统兼容的问题么?防火墙都关了。

可否支持log读取

如题。感谢大佬提供神器,想知道是否可以像Android的adb一样支持读取运行时日志

性能数据如何采集?

看到你testerhome文章里面写到性能采集(类似 PerfDog)不过这块暂时只有 API 可以用,没有看到具体的使用,请问可以给一个具体的demo么?

求解connect to device error: UsbmuxReplyCode.ConnectionRefused

wda装好了,连mac 执行iproxy 8100 8100 访问http://localhost:8100/status可以看到手机信息

但是连windosw,执行tidevice xctest -B com.facebook.wda.WebDriverAgent.Runner -e USB_PORT:8200 提示WebDriverAgent start successfully,然后执行tidevice relay 8100 8100,访问http://localhost:8100/status 报错
handle stream from: ('::1', 59494, 0, 0)
connect to device error: UsbmuxReplyCode.ConnectionRefused
请问怎么解呀

connect to device error: UsbmuxReplyCode.ConnectionRefused

请问下出现这个报错是因为web driver agent 没有安装的原因嘛
C:\Users\EDZ>tidevice relay 8100 8100
[D 210330 15:44:15 _relay:36] handle stream from: ('::1', 59640, 0, 0)
[E 210330 15:44:15 _relay:46] connect to device error: UsbmuxReplyCode.ConnectionRefused
[D 210330 15:44:15 _relay:36] handle stream from: ('::1', 59642, 0, 0)

无法在windows 10通过tidevice启动wda

C:\Users\freem>tidevice developer
Traceback (most recent call last):
File "c:\users\freem\appdata\local\programs\python\python38\lib\runpy.py", line 194, in run_module_as_main
return run_code(code, main_globals, None,
File "c:\users\freem\appdata\local\programs\python\python38\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\freem\AppData\Local\Programs\Python\Python38\Scripts\tidevice.exe_main
.py", line 7, in
File "c:\users\freem\appdata\local\programs\python\python38\lib\site-packages\tidevice_main
.py", line 483, in main
actionsargs.subparser
File "c:\users\freem\appdata\local\programs\python\python38\lib\site-packages\tidevice_main
.py", line 280, in cmd_developer
d = udid2device(args.udid)
File "c:\users\freem\appdata\local\programs\python\python38\lib\site-packages\tidevice_main
.py", line 70, in _udid2device
_udid = complete_udid(udid)
File "c:\users\freem\appdata\local\programs\python\python38\lib\site-packages\tidevice_main
.py", line 44, in _complete_udid
infos = um.device_list()
File "c:\users\freem\appdata\local\programs\python\python38\lib\site-packages\tidevice_usbmux.py", line 72, in device_list
data = self.send_recv(payload)
File "c:\users\freem\appdata\local\programs\python\python38\lib\site-packages\tidevice_usbmux.py", line 45, in send_recv
with self.create_connection() as s:
File "c:\users\freem\appdata\local\programs\python\python38\lib\site-packages\tidevice_usbmux.py", line 42, in create_connection
return PlistSocket(self.__address, self._next_tag())
File "c:\users\freem\appdata\local\programs\python\python38\lib\site-packages\tidevice_safe_socket.py", line 92, in init
super().init(addr)
File "c:\users\freem\appdata\local\programs\python\python38\lib\site-packages\tidevice_safe_socket.py", line 48, in init
self._sock.connect(addr)
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

xctrunner quited退出问题 AttributeError: 'NoneType' object has no attribute 'conversation_index'

[D 210324 18:52:55 _device:942] logProcess: t = 24.55s Requesting snapshot of accessibility hierarchy for app with pid 3966
Exception in thread Thread-2:
Traceback (most recent call last):
File "d:\appstore\python37\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "d:\appstore\python37\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "d:\appstore\python37\lib\site-packages\tidevice_instruments.py", line 558, in _drain
self._drain_single_message()
File "d:\appstore\python37\lib\site-packages\tidevice_instruments.py", line 578, in _drain_single_message
mheader, payload = self.recv_dtx_message()
File "d:\appstore\python37\lib\site-packages\tidevice_instruments.py", line 499, in recv_dtx_message
assert mheader.conversation_index in [0, 1, 2]
AttributeError: 'NoneType' object has no attribute 'conversation_index'
[I 210324 18:52:55 _device:1114]
xctrunner quited

什么原因造成的运行中途退出,随机出现此问题

wda重签名后运行tidevice xctest 报错 socket connection broken

python3.6&3.8
mac 10.15.5
log:

[I 210201 21:10:10 _device:912] BundleID: com.xxxxxxxxxx.WebDriverAgentRunner-Runner
[I 210201 21:10:10 _device:914] DeviceIdentifier: 00008030-xxxxxxxxxxxxE
[I 210201 21:10:10 _device:775] SignIdentity: 'iPhone Distribution: xxxxxxxxx Co., Ltd.'
Traceback (most recent call last):
  File "/Users/xx/.pyenv/versions/uiauto8/bin/tidevice", line 8, in <module>
    sys.exit(main())
  File "/Users/xx/.pyenv/versions/3.8.6/envs/uiauto8/lib/python3.8/site-packages/tidevice/__main__.py", line 429, in main
    actions[args.subparser](args)
  File "/Users/xx/.pyenv/versions/3.8.6/envs/uiauto8/lib/python3.8/site-packages/tidevice/__main__.py", line 209, in cmd_xctest
    d.xctest(args.bundle_id, logger=setup_logger(level=logging.INFO), env=env)
  File "/Users/xx/.pyenv/versions/3.8.6/envs/uiauto8/lib/python3.8/site-packages/tidevice/_device.py", line 985, in xctest
    pid = self._launch_wda(bundle_id, session_identifier, env=env, logger=logger)
  File "/Users/xx/.pyenv/versions/3.8.6/envs/uiauto8/lib/python3.8/site-packages/tidevice/_device.py", line 786, in _launch_wda
    for fname in fsync.listdir("/tmp"):
  File "/Users/xx/.pyenv/versions/3.8.6/envs/uiauto8/lib/python3.8/site-packages/tidevice/_sync.py", line 106, in listdir
    pkg = self._recv()
  File "/Users/xx/.pyenv/versions/3.8.6/envs/uiauto8/lib/python3.8/site-packages/tidevice/_sync.py", line 77, in _recv
    buf = buf + self.recvall(FHeader.size - len(buf))
  File "/Users/xx/.pyenv/versions/3.8.6/envs/uiauto8/lib/python3.8/site-packages/tidevice/_safe_socket.py", line 55, in recvall
    raise MuxError("socket connection broken")
tidevice.exceptions.MuxError: socket connection broken

多设备使用relay代理给Appium跑自动化会出现xctrunner quited

报错信息

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
[W 210203 13:54:59 _device:1042] xctrunner quited

启动代理的代码tidevice -u ${udid} relay ${extendPort} 8100
有在Appium中有设置webDriverAgentUrl

WDA应用从手机删除以后,通过tidevice的app_list()接口仍会返回WDA的bundleID

  1. 操作步骤:
  • 将WDA应用从手机中删除;
  • 脚本中调用tidevice的app_list()接口获取手机应用的bundleID的列表:
    '''
    device = tidevice.Device(self.get_udid())
    app_list = device.instruments.app_list()
    '''
  1. 异常现象:
    app_list中仍有卸载掉的WDA应用的bundleID
  2. 期望结果:
    app_list中不出现卸载掉的WDA应用的bundleID
    @zy02636 @codeskyblue @alibaba-oss @373743261 @pengchenglin

tidevice list可用但是tideivce applist 报错,之前是可以的,现在不知道为啥不行了

File "d:\python3.7.8\lib\site-packages\tidevice_usbmux.py", line 81, in _check
raise MuxReplyError(data['Number'])
File "d:\python3.7.8\lib\site-packages\tidevice\exceptions.py", line 14, in init
self.reply_code = UsbmuxReplyCode(number)
File "d:\python3.7.8\lib\enum.py", line 315, in call
return cls.new(cls, value)
File "d:\python3.7.8\lib\enum.py", line 569, in new
raise exc
File "d:\python3.7.8\lib\enum.py", line 553, in new
result = cls.missing(value)
File "d:\python3.7.8\lib\enum.py", line 582, in missing
raise ValueError("%r is not a valid %s" % (value, cls.name))
ValueError: 22 is not a valid UsbmuxReplyCode

image

tidevice\_usbmux.py的device_udid_list()方法运行出现ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接

Exception in thread DeviceRefreshThread_ios:
Traceback (most recent call last):
File "device\device_pool.py", line 141, in refresh_devices
File "device\ios\ios_device_pool.py", line 19, in refresh_devices0
File "idb\idb.py", line 14, in device_udid_list
File "tidevice_usbmux.py", line 77, in device_udid_list
File "tidevice_usbmux.py", line 72, in device_list
File "tidevice_usbmux.py", line 45, in send_recv
File "tidevice_usbmux.py", line 42, in create_connection
File "tidevice_safe_socket.py", line 92, in init
File "tidevice_safe_socket.py", line 48, in init
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。
@zy02636 @codeskyblue @alibaba-oss @373743261 @pengchenglin

tidevice.exceptions.MuxReplyError: UsbmuxReplyCode.BadDevice

在一台 iPhone 7P 设备上运行 tidevice applist 报错,其他设备正常

具体错误日志

tidevice applist
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/tidevice/_device.py", line 192, in handshake
self._pair_record = self._read_pair_record()
File "/usr/local/lib/python3.8/site-packages/tidevice/_device.py", line 163, in _read_pair_record
data = self._usbmux.send_recv(payload)
File "/usr/local/lib/python3.8/site-packages/tidevice/_usbmux.py", line 48, in send_recv
self._check(recv_data)
File "/usr/local/lib/python3.8/site-packages/tidevice/_usbmux.py", line 81, in _check
raise MuxReplyError(data['Number'])
tidevice.exceptions.MuxReplyError: UsbmuxReplyCode.BadDevice

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/tidevice", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/tidevice/main.py", line 407, in main
actionsargs.subparser
File "/usr/local/lib/python3.8/site-packages/tidevice/main.py", line 226, in cmd_applist
for info in d.installation.iter_installed():
File "/usr/local/lib/python3.8/site-packages/tidevice/_device.py", line 483, in installation
conn = self.start_service(Installation.SERVICE_NAME)
File "/usr/local/lib/python3.8/site-packages/tidevice/_device.py", line 400, in start_service
return self._unsafe_start_service(name)
File "/usr/local/lib/python3.8/site-packages/tidevice/_device.py", line 408, in _unsafe_start_service
with self.create_session() as s:
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", line 113, in enter
return next(self.gen)
File "/usr/local/lib/python3.8/site-packages/tidevice/_device.py", line 272, in create_session
"HostID": self.pair_record['HostID'],
File "/usr/local/lib/python3.8/site-packages/tidevice/_device.py", line 127, in pair_record
self.handshake()
File "/usr/local/lib/python3.8/site-packages/tidevice/_device.py", line 195, in handshake
self.pair()
File "/usr/local/lib/python3.8/site-packages/tidevice/_device.py", line 180, in pair
iconsole_path = get_binary_by_name("iconsole")
File "/usr/local/lib/python3.8/site-packages/tidevice/_utils.py", line 47, in get_binary_by_name
raise RuntimeError("Binary file {} not exist".format(name))
RuntimeError: Binary file iconsole not exist

无法启动wda

tidevice xctest -B com.facebook.WebDriverAgentRunner
[I 210130 11:12:10 _device:909] BundleID: com.facebook.WebDriverAgentRunner
[I 210130 11:12:10 _device:911] DeviceIdentifier: 00008020-00160C200EDA002E
[I 210130 11:12:10 _device:773] SignIdentity: 'Apple Development: xxx'
[E 210130 11:12:10 _device:837] Launch failed: NSError(CODE:2 DOMAIN:com.apple.dt.deviceprocesscontrolservice INFO:{'NSLocalizedDescription': 'Request to launch '
'com.facebook.WebDriverAgentRunner'
'failed.',
'NSLocalizedFailureReason': 'The operation couldn’t be completed. Launch '
'failed : Failed to launch process with bundle '
'identifier '
"'com.facebook.WebDriverAgentRunner'.",
'NSUnderlyingError': NSError(CODE:1 DOMAIN:SBWorkspaceTransaction INFO:{'NSLocalizedFailureReason': 'Launch failed',
'SBTransaction': 'SBSuspendedWorkspaceTransaction'})})
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/bin/tidevice", line 8, in
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tidevice/main.py", line 407, in main
actionsargs.subparser
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tidevice/main.py", line 203, in cmd_xctest
d.xctest(args.bundle_id, logger=setup_logger(level=logging.INFO))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tidevice/_device.py", line 982, in xctest
pid = self._launch_wda(bundle_id, session_identifier, logger)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tidevice/_device.py", line 838, in _launch_wda
raise MuxError("Launch failed")
tidevice.exceptions.MuxError: Launch failed

Unable to build WebDriverAgentRunner ipa file

Hi,

I am trying to build web driver agent ipa, by following your DEVELOP.md instructions, but noticed that the xcode project doesn't have a scheme WebDriverAgent. Can you please provide instructions on how to build the ipa from xcode/xcodebuild.

[tidevice install error ]io.unsupportedoperation: seek

commond:
tidevice --udid 648a03dfcbbfda416b28114c04109e07e99xxxxxxx install http://xxxxxxxxx/aaa.ipa

error:
[7.1 MB/s 2s] Traceback (most recent call last):
File "/home/zsq/.local/bin/tidevice", line 11, in
sys.exit(main())
File "/home/zsq/.local/lib/python3.6/site-packages/tidevice/main.py", line 475, in main
actionsargs.subparser
File "/home/zsq/.local/lib/python3.6/site-packages/tidevice/main.py", line 121, in cmd_install
bundle_id = d.app_install(args.filepath_or_url)
File "/home/zsq/.local/lib/python3.6/site-packages/tidevice/_device.py", line 684, in app_install
bundle_id = ir.get_bundle_id()
File "/home/zsq/.local/lib/python3.6/site-packages/tidevice/_ipautil.py", line 57, in get_bundle_id
return self.get_infoplist()['CFBundleIdentifier']
File "/home/zsq/.local/lib/python3.6/site-packages/tidevice/_ipautil.py", line 53, in get_infoplist
return bplist.load(fp)
File "/home/zsq/.local/lib/python3.6/site-packages/tidevice/plistlib2.py", line 966, in load
fp.seek(0)
io.UnsupportedOperation: seek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.