ATX atxserver2 部署遇到一些问题

萧帅 · 2020年10月14日 · 2891 次阅读

1、使用 pip 安装 uiautomator2 时候总是报如下错误
终端命令行 pip install -U uiautomator2
D:\allure\atx-agent_0.9.5_linux_armv7>pip install -U uiautomator2
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))': /simple/uiautomator2/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))': /simple/uiautomator2/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))': /simple/uiautomator2/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))': /simple/uiautomator2/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))': /simple/uiautomator2/
Could not fetch URL https://pypi.org/simple/uiautomator2/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/uiautomator2/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))) - skipping

默认 pip 是使用 Python 官方的源,但是由于国外官方源经常被墙,导致不可用,我们可以使用国内的 python 镜像源,从而解决
上网也找了很多方法,亲测有效~
pip install -U uiautomator2 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

参考链接:https://blog.csdn.net/qq_37344125/article/details/102649897

2、终端命令行输入 python -m uiautomator2 init 下载 minicap, minitouch 报 SSL 证书问题

D:\allure\atx-agent_0.9.5_linux_armv7>python -m uiautomator2 init
[I 201013 18:58:14 init:155] uiautomator2 version: 2.11.5.dev1
[I 201013 18:58:14 init:352] Install minicap, minitouch
[D 201013 18:58:14 init:62] Download https://tool.appetizer.io/openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch
[D 201013 18:58:14 init:111] download error from mirror(HTTPSConnectionPool(host='tool.appetizer.io', port=443): Max retries exceeded with url: /openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (ssl.c:1076)')))), use origin source
[D 201013 18:58:14 init:62] Download https://github.com/openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch
[W 201013 18:58:15 api:40] HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))), retrying in 0 seconds...
[D 201013 18:58:15 init:62] Download https://tool.appetizer.io/openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch
[D 201013 18:58:15 init:111] download error from mirror(HTTPSConnectionPool(host='tool.appetizer.io', port=443): Max retries exceeded with url: /openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')))), use origin source
[D 201013 18:58:15 init:62] Download https://github.com/openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch
Traceback (most recent call last):
File "D:\python37\lib\site-packages\urllib3\connectionpool.py", line 662, in urlopen
self._prepare_proxy(conn)
File "D:\python37\lib\site-packages\urllib3\connectionpool.py", line 948, in _prepare_proxy
conn.connect()
File "D:\python37\lib\site-packages\urllib3\connection.py", line 394, in connect
ssl_context=context,
File "D:\python37\lib\site-packages\urllib3\util\ssl
.py", line 370, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "D:\python37\lib\ssl.py", line 423, in wrap_socket
session=session
File "D:\python37\lib\ssl.py", line 870, in _create
self.do_handshake()
File "D:\python37\lib\ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\python37\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "D:\python37\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "D:\python37\lib\site-packages\urllib3\util\retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\python37\lib\runpy.py", line 193, in run_module_as_main
"
main", mod_spec)
File "D:\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\python37\lib\site-packages\uiautomator2__main
.py", line 246, in
main()
File "D:\python37\lib\site-packages\uiautomator2__main
.py", line 236, in main
actionsargs.subparser
File "D:\python37\lib\site-packages\uiautomator2__main
_.py", line 34, in cmd_init
init.install(args.server)
File "D:\python37\lib\site-packages\uiautomator2\init.py", line 353, in install
self.push_url(self.minitouch_url)
File "", line 2, in push_url
File "D:\python37\lib\site-packages\retry\api.py", line 74, in retry_decorator
logger)
File "D:\python37\lib\site-packages\retry\api.py", line 33, in __retry_internal
return f()
File "D:\python37\lib\site-packages\uiautomator2\init.py", line 222, in push_url
logger=self.logger)
File "D:\python37\lib\site-packages\uiautomator2\init.py", line 113, in mirror_download
return cache_download(url, filename, storepath=storepath, logger=logger)
File "D:\python37\lib\site-packages\uiautomator2\init.py", line 72, in cache_download
r = requests.get(url, stream=True, headers=headers, timeout=None)
File "D:\python37\lib\site-packages\requests\api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "D:\python37\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "D:\python37\lib\site-packages\requests\sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "D:\python37\lib\site-packages\requests\sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "D:\python37\lib\site-packages\requests\adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')))

解决方案:python 安装目录 Lib/site-packages/requests/adapters.py

D:\python37>python -m uiautomator2 init
[I 201014 09:42:35 init:155] uiautomator2 version: 2.11.5.dev1
[I 201014 09:42:35 init:352] Install minicap, minitouch
[D 201014 09:42:35 init:59] Use cached assets: C:\Users\xiaows.uiautomator2\cache\minitouch-d9b00c06bb\minitouch
[D 201014 09:42:35 init:232] Push to /data/local/tmp/minitouch:0755
[D 201014 09:42:35 init:59] Use cached assets: C:\Users\xiaows.uiautomator2\cache\minicap.so-1bae78be21\minicap.so
[D 201014 09:42:35 init:232] Push to /data/local/tmp/minicap.so:0755
[D 201014 09:42:35 init:59] Use cached assets: C:\Users\xiaows.uiautomator2\cache\minicap-e06ae097fd\minicap
[D 201014 09:42:35 init:232] Push to /data/local/tmp/minicap:0755
[D 201014 09:42:36 init:250] apk-debug package-info: {'version_name': '2.3.1', 'version_code': '2003001', 'flags': ['DEBUGGABLE', 'HAS_CODE', 'ALLOW_CLEAR_USER_DATA', 'ALLOW_BACKUP'], 'first_install_time': datetime.datetime(2020, 10, 14, 8, 37, 37), 'last_update_time': datetime.datetime(2020, 10, 14, 8, 37, 37), 'signature': '8376b3fb], past signatures:['}
[D 201014 09:42:36 init:251] apk-debug-test package-info: None
[I 201014 09:42:36 init:367] Install com.github.uiautomator, com.github.uiautomator.test 2.3.1
[D 201014 09:42:36 init:162] Shell: ('pm', 'uninstall', 'com.github.uiautomator')
[D 201014 09:42:36 init:162] Shell: ('pm', 'uninstall', 'com.github.uiautomator.test')
[D 201014 09:42:37 init:59] Use cached assets: C:\Users\xiaows.uiautomator2\cache\app-uiautomator.apk-81d5349503\app-uiautomator.apk
[D 201014 09:42:37 init:232] Push to /data/local/tmp/app-uiautomator.apk:0644
[D 201014 09:42:37 init:162] Shell: ('pm', 'install', '-r', '-t', '/data/local/tmp/app-uiautomator.apk')
[I 201014 09:42:47 init:332] - app-uiautomator.apk installed
[D 201014 09:42:47 init:59] Use cached assets: C:\Users\xiaows.uiautomator2\cache\app-uiautomator-test.apk-a0b8958cc1\app-uiautomator-test.apk
[D 201014 09:42:47 init:232] Push to /data/local/tmp/app-uiautomator-test.apk:0644
[D 201014 09:42:47 init:162] Shell: ('pm', 'install', '-r', '-t', '/data/local/tmp/app-uiautomator-test.apk')
[I 201014 09:43:09 init:332] - app-uiautomator-test.apk installed
[D 201014 09:43:10 init:291] Real version: [0, 9, 5], Expect version: [0, 9, 5]
[D 201014 09:43:10 init:162] Shell: ('/data/local/tmp/atx-agent', 'server', '--nouia', '-d')
[I 201014 09:43:10 init:377] Check atx-agent version
[D 201014 09:43:10 init:390] Forward: local:tcp:64486 -> remote:tcp:7912
[D 201014 09:43:10 init:390] Forward: local:tcp:64486 -> remote:tcp:7912
[D 201014 09:43:10 init:393] atx-agent version 0.9.5
Successfully init AdbDevice(serial=72cccfb3)

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册