正则表达式这个不是很懂,看文档是这样描述的,希望能帮到你
| regex_match
| regex matches | re.match(B, A) | 'abcdef' regex 'a\w+d' |
首先确保电脑正常连接手机,然后通过 SecureCRT 连接到电脑,再通过 adb shell 命令连接手机
看 u2 的文档说明,目前支持:d.app_install('http://some-domain.com/some.apk')
按我理解,主要有两个原因我觉得不能这样做:
1、对于一些较复杂的测试场景,一个用例中可能会涉及多个接口,一个接口可能包含在多个用例中,这种情况下,用用例实现接口描述会产生混乱
2、即使是一个用例中只包含一个接口的情况,但是一个接口肯定不只有一组测试数据,也就是,一个接口的用例有多个,那么我便无法说在一个用例中体现完整的接口描述
按我个人理解,接口文档中对一个接口的描述一般会包含 url、请求方式、输入参数、响应结果信息等,如果在接口自动化测试中,能够将一个接口的这些信息也放进来,使其既有可读性也能参与到自动化测试中,,,这就是我理解的接口描述哈
奇怪的是我有重新启动那个工具,但还是不行,我后面去加下白名单试试,谢谢你的建议
优先级不高导致的杀死问题我后面去验证看看,,,那个 python3.6 的我还没用到,不太清楚诶,你试试,有空的话能不能告诉我
1 手机没有联网——我这边是正常联网的
2 手机重启了 ——我虽然重启手机了,但是我也会重新启动 uiautomator 工具,这个操作有什么不对吗?
3 手机和 PC 不在同一个网段 ——一直都是连着那个网的,之前是可以正常连接的,应该不是这个问题
4 有人点击了 uiautomator app 上的停止 atx-agent——没有手工停止,不知道会不会系统自动杀死,不过我尝试过退出 uiautomator 工具,然后再重新启动,不过还是不行,这个操作会重新启动 atx-agent 的吗?最后还是要卸载重装启动才好
那个工具连接一段时间后又出现问题了。。。
C:\Users\Administrator>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (
AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import uiautomator2 as u2
d=u2.connect("dfxxxxx41")
这个是 uiautomator 工具有问题时的报错:
d.info
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\uiautomator2_init.py", line 716, in _
getattr__
return getattr(self.default_session, attr)
File "C:\Python27\lib\site-packages\uiautomator2__init.py", line 1082, in i
nfo
return self.jsonrpc.deviceInfo()
File "C:\Python27\lib\site-packages\uiautomator2__init.py", line 275, in _
call__
return self.server.jsonrpc_retry_call(self.method, params, http_timeout)
File "C:\Python27\lib\site-packages\uiautomator2_init.py", line 281, in js
onrpc_retry_call
return self.jsonrpc_call(*args, **kwargs)
File "C:\Python27\lib\site-packages\uiautomator2__init.py", line 304, in js
onrpc_call
data=data)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 522, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "C:\Python27\lib\site-packages\uiautomator2__init_.py", line 185, in re
quest
resp = super(TimeoutRequestsSession, self).request(method, url, **kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 475, in reques
t
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests\adapters.py", line 473, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(10054, ''))
这个是我卸载后重装,uiautomator 工具正常时的显示:
d.info
{u'displayRotation': 0, u'displaySizeDpY': 640, u'displaySizeDpX': 360, u'screen
On': True, u'currentPackageName': u'com.hmct.vision', u'productName': u'A1', u'd
isplayWidth': 1080, u'sdkInt': 22, u'displayHeight': 1920, u'naturalOrientation'
: True}
哈哈,其实那个 github 和你的博客已经写得很全了,只是习惯性大概整理下。后面有情况发你 ,不过目前我判断它有问题的情况是(也有可能我漏了哪些信息判断失误):我在环境部署好,确保手机是正常连接的情况下去跑脚本,可是这脚本跑了几天,就会出现连接不上设备的情况,这时我都直接暴力处理,卸载重装然后就正常了
安卓手机,连接时老是报错,求助!!!
C:\Users\Administrator>python -m weditor
listen port 17310
[I 180209 11:13:51 web:2087] 304 GET /api/v1/version (::1) 1.00ms
[I 180209 11:13:57 web:2087] 200 POST /api/v1/connect (::1) 167.00ms
SN ae95d684-4eb1-40b5-a099-282d7cb6924b
W 180209 11:13:59 api:40), retrying i
n 0.5 seconds...
W 180209 11:13:59 api:40), retrying i
n 0.6 seconds...
W 180209 11:14:00 api:40), retrying i
n 0.7 seconds...
W 180209 11:14:01 api:40), retrying i
n 0.8 seconds...
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\weditor_main_.py", line 134, in get
d.screenshot().convert("RGB").save(buffer, format='JPEG')
File "", line 2, in screenshot
File "C:\Python27\lib\site-packages\retry\api.py", line 74, in retry_decorator
logger)
File "C:\Python27\lib\site-packages\retry\api.py", line 33, in retry_interna
l
return f()
File "C:\Python27\lib\site-packages\uiautomator2__init.py", line 1006, in s
creenshot
r = requests.get(self.server.screenshot_uri, timeout=10)
File "C:\Python27\lib\site-packages\requests\api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "C:\Python27\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 508, in reques
t
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests\adapters.py", line 490, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(10054, ''))
[W 180209 11:14:02 web:2087] 430 GET /api/v1/devices/ae95d684-4eb1-40b5-a099-282
d7cb6924b/screenshot (::1) 2675.00ms
解决了吗?我报跟你一样的问题,弄来弄去还是没解决
找到原因了,我忘了 connect 手机
执行 python -m weditor 时会报错,求助!!
C:\Users\Administrator>python -m weditor
listen port 17310
[I 180205 11:22:46 web:2087] 304 GET /api/v1/version (::1) 1.00ms
SN -
[E 180205 11:22:56 web:1614] Uncaught exception GET /api/v1/devices/-/screenshot
(::1)
HTTPServerRequest(protocol='http', host='localhost:17310', method='GET', uri
='/api/v1/devices/-/screenshot', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\tornado\web.py", line 1534, in execut
e
result = method(*self.path_args, **self.path_kwargs)
File "C:\Python27\lib\site-packages\weditor__main_.py", line 134, in get
d.screenshot().convert("RGB").save(buffer, format='JPEG')
AttributeError: 'NoneType' object has no attribute 'screenshot'
感谢分享,已修改
既然是自动化测试框架,应该差不多都具备这些个功能吧,你说的这个我还没接触过,知识欠缺没有发言权,后面有空补补