Open chenq8 opened 4 years ago
你的调用方法写错了吧 案例给出的demo是如下写的
------------------ 原始邮件 ------------------ 发件人: "openatx/uiautomator2" <notifications@github.com>; 发送时间: 2020年11月3日(星期二) 上午9:47 收件人: "openatx/uiautomator2"<uiautomator2@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [openatx/uiautomator2] android11使用d.screenrecord()无法生成视频,偶尔会有报错信息,麻烦看一下 (#611)
` import uiautomator2 as u2
def test_record(): d = u2.connect() d.debug=True r = d.screenrecord('tmp.mp4') d(text='Duo').click() r.stop()
if name == 'main': test_record() output: {'udid': 'f28f92ad-6a:3b:6d:d4:96:18-R678EL', 'version': '11', 'serial': 'f28f92ad', 'brand': 'Orbic', 'model': 'R678EL', 'hwaddr': '6a:3b:6d:d4:96:18', 'port': 7912, 'sdk': 30, 'agentVersion': '0.9.5', 'display': {'width': 720, 'height': 1600}, 'battery': {'acPowered': False, 'usbPowered': True, 'wirelessPowered': False, 'status': 2, 'health': 2, 'present': True, 'level': 100, 'scale': 100, 'voltage': 4383, 'temperature': 318, 'technology': 'Li-ion'}, 'memory': {'total': 5618860, 'around': '5 GB'}, 'cpu': {'cores': 8, 'hardware': 'Qualcomm Technologies, Inc LAGOON'}, 'arch': '', 'owner': None, 'presenceChangedAt': '0001-01-01T00:00:00Z', 'usingBeganAt': '0001-01-01T00:00:00Z', 'product': None, 'provider': None} 09:44:34.186 $ curl -X POST -d '{"jsonrpc": "2.0", "id": "342b2646bffb8b7a69c69ed97aeb261f", "method": "waitForExists", "params": [{"mask": 1, "childOrSibling": [], "childOrSiblingSelector": [], "text": "Duo"}, 20000]}' 'http://localhost:54760/jsonrpc/0' 09:44:34.253 Response (66 ms) >>> {"jsonrpc":"2.0","id":"342b2646bffb8b7a69c69ed97aeb261f","result":true} <<< END 09:44:34.255 $ curl -X POST -d '{"jsonrpc": "2.0", "id": "ec0f66a8f374e0e6c21e62ea0123dea2", "method": "objInfo", "params": [{"mask": 1, "childOrSibling": [], "childOrSiblingSelector": [], "text": "Duo"}]}' 'http://localhost:54760/jsonrpc/0' 09:44:34.398 Response (142 ms) >>> {"jsonrpc":"2.0","id":"ec0f66a8f374e0e6c21e62ea0123dea2","result":{"bounds":{"bottom":1230,"left":294,"right":427,"top":1004},"childCount":0,"className":"android.widget.TextView","contentDescription":"Duo","packageName":"com.android.launcher3","resourceName":null,"text":"Duo","visibleBounds":{"bottom":1230,"left":294,"right":427,"top":1004},"checkable":false,"checked":false,"clickable":true,"enabled":true,"focusable":true,"focused":false,"longClickable":true,"scrollable":false,"selected":false}} <<< END 09:44:34.398 $ curl -X POST -d '{"jsonrpc": "2.0", "id": "8d10afabfdb5ac90ca33773e262468a8", "method": "click", "params": [360.5, 1117.0]}' 'http://localhost:54760/jsonrpc/0' 09:44:34.603 Response (205 ms) >>> {"jsonrpc":"2.0","id":"8d10afabfdb5ac90ca33773e262468a8","result":true} <<< END Exception in thread image2video: Traceback (most recent call last): File "E:\MyIDLE\Python3\lib\site-packages\uiautomator2\screenrecord.py", line 77, in _pipe_resize firstim = next(image_iter) StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "E:\MyIDLE\Python3\lib\threading.py", line 932, in _bootstrap_inner self.run() File "E:\MyIDLE\Python3\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "E:\MyIDLE\Python3\lib\site-packages\uiautomator2\screenrecord.py", line 107, in _run for im in _iter: RuntimeError: generator raised StopIteration
`
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
没有 同样的demo 使用android10是可以正常录制的
看你上一封邮件的报错,是这个方法报错了,这个方法是处理数据的,很有可能没有获取到图片。 而图片来源是向手机中安装minicap服务,由minicap向电脑端推送图片数据流,然后将接收到的数据流转化为图片,你可以试着从这个思路去看下能不能解决你的问题。
------------------ 原始邮件 ------------------ 发件人: "openatx/uiautomator2" <notifications@github.com>; 发送时间: 2020年11月3日(星期二) 上午10:01 收件人: "openatx/uiautomator2"<uiautomator2@noreply.github.com>; 抄送: "Allen "<1755838904@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [openatx/uiautomator2] android11使用d.screenrecord()无法生成视频,偶尔会有报错信息,麻烦看一下 (#611)
没有 同样的demo 使用android10是可以正常录制的
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
请问一下 这是不是Minicap安装不成功?
应该找到原因了
https://github.com/openatx/stf-binaries/tree/0.2.2/node_modules/minicap-prebuilt-beta/prebuilt/
下载 minicap.so 和 minitouch 只支持sdk 29
需要重新编译支持sdk30的文件上传
应该找到原因了 https://github.com/openatx/stf-binaries/tree/0.2.2/node_modules/minicap-prebuilt-beta/prebuilt/ 下载 minicap.so 和 minitouch 只支持sdk 29 需要重新编译支持sdk30的文件上传
我用你的重新上传了,但是还是不行,我的是小米10 安卓11的
应该找到原因了 https://github.com/openatx/stf-binaries/tree/0.2.2/node_modules/minicap-prebuilt-beta/prebuilt/ 下载 minicap.so 和 minitouch 只支持sdk 29 需要重新编译支持sdk30的文件上传
我用你的重新上传了,但是还是不行,我的是小米10 安卓11的
我尝试了https://github.com/WeiPeiXian/minicap/tree/master/minicap.so 这个的可以了
试了 android10 是可以录制的 ` import uiautomator2 as u2
def test_record(): d = u2.connect() d.debug=True r = d.screenrecord('tmp.mp4') d(text='Duo').click() r.stop()
if name == 'main': test_record()
output:
{'udid': 'f28f92ad-6a:3b:6d:d4:96:18-R678EL', 'version': '11', 'serial': 'f28f92ad', 'brand': 'Orbic', 'model': 'R678EL', 'hwaddr': '6a:3b:6d:d4:96:18', 'port': 7912, 'sdk': 30, 'agentVersion': '0.9.5', 'display': {'width': 720, 'height': 1600}, 'battery': {'acPowered': False, 'usbPowered': True, 'wirelessPowered': False, 'status': 2, 'health': 2, 'present': True, 'level': 100, 'scale': 100, 'voltage': 4383, 'temperature': 318, 'technology': 'Li-ion'}, 'memory': {'total': 5618860, 'around': '5 GB'}, 'cpu': {'cores': 8, 'hardware': 'Qualcomm Technologies, Inc LAGOON'}, 'arch': '', 'owner': None, 'presenceChangedAt': '0001-01-01T00:00:00Z', 'usingBeganAt': '0001-01-01T00:00:00Z', 'product': None, 'provider': None} 09:44:34.186 $ curl -X POST -d '{"jsonrpc": "2.0", "id": "342b2646bffb8b7a69c69ed97aeb261f", "method": "waitForExists", "params": [{"mask": 1, "childOrSibling": [], "childOrSiblingSelector": [], "text": "Duo"}, 20000]}' 'http://localhost:54760/jsonrpc/0' 09:44:34.253 Response (66 ms) >>> {"jsonrpc":"2.0","id":"342b2646bffb8b7a69c69ed97aeb261f","result":true} <<< END 09:44:34.255 $ curl -X POST -d '{"jsonrpc": "2.0", "id": "ec0f66a8f374e0e6c21e62ea0123dea2", "method": "objInfo", "params": [{"mask": 1, "childOrSibling": [], "childOrSiblingSelector": [], "text": "Duo"}]}' 'http://localhost:54760/jsonrpc/0' 09:44:34.398 Response (142 ms) >>> {"jsonrpc":"2.0","id":"ec0f66a8f374e0e6c21e62ea0123dea2","result":{"bounds":{"bottom":1230,"left":294,"right":427,"top":1004},"childCount":0,"className":"android.widget.TextView","contentDescription":"Duo","packageName":"com.android.launcher3","resourceName":null,"text":"Duo","visibleBounds":{"bottom":1230,"left":294,"right":427,"top":1004},"checkable":false,"checked":false,"clickable":true,"enabled":true,"focusable":true,"focused":false,"longClickable":true,"scrollable":false,"selected":false}} <<< END 09:44:34.398 $ curl -X POST -d '{"jsonrpc": "2.0", "id": "8d10afabfdb5ac90ca33773e262468a8", "method": "click", "params": [360.5, 1117.0]}' 'http://localhost:54760/jsonrpc/0' 09:44:34.603 Response (205 ms) >>> {"jsonrpc":"2.0","id":"8d10afabfdb5ac90ca33773e262468a8","result":true} <<< END Exception in thread image2video: Traceback (most recent call last): File "E:\MyIDLE\Python3\lib\site-packages\uiautomator2\screenrecord.py", line 77, in _pipe_resize firstim = next(image_iter) StopIterationThe above exception was the direct cause of the following exception:
Traceback (most recent call last): File "E:\MyIDLE\Python3\lib\threading.py", line 932, in _bootstrap_inner self.run() File "E:\MyIDLE\Python3\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "E:\MyIDLE\Python3\lib\site-packages\uiautomator2\screenrecord.py", line 107, in _run for im in _iter: RuntimeError: generator raised StopIteration
`