openatx-archive / atx-server Goto Github PK
View Code? Open in Web Editor NEWmanage all the atx-agents
License: MIT License
manage all the atx-agents
License: MIT License
因为总是想在程序里开启数据库和atx服务,用完就关闭,现在只能强制杀死进程,很不优雅
插入手机到mac后
由于 python -m uiautomator2 init localhost:8000 的方法的install_minicap等方法出现SSLError的问题,我手动下载了app-uiautomator.apk,minitouch,minicap.so, atx-agent并上传至android手机,然后执行launch_and_check的方法启动agent成功。通过 curl $DEVICE_URL/info 也可以获得手机的info信息
但我打开atx-server --port 8000后查看 localhost:8000 没有看到有手机绑定过来,查看rethinkdb也是没有手机信息的,保证是同一个网络的,应该怎样排查呢。我看到 main.go 里有以下代码,不太理解到底是atx-server主动获取android info的并记录到rethinkdb的,还是atx-agent主动上传信息到rethinkdb的。
// Read device info message := &proto.CommonMessage{} if err := ws.ReadJSON(message); err != nil { log.Warn("error: read json message") return }
ialing ...
2018-12-14 16:17:39,775 - main.py:133 - INFO - install minicap
2018-12-14 16:17:39,994 - main.py:140 - INFO - install minitouch
2018-12-14 16:17:40,428 - main.py:168 - INFO - apk(1.1.7) already installed,
skip
2018-12-14 16:17:40,429 - main.py:350 - INFO - atx-agent is already running,
force stop
2018-12-14 16:17:41,041 - main.py:227 - INFO - atx-agent(0.5.1) is installin
g, please be patient
Traceback (most recent call last):
File "C:\Python37\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "C:\Python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Python37\lib\site-packages\uiautomator2_main.py", line 424, in
main()
File "C:\Python37\lib\site-packages\uiautomator2_main.py", line 420, in ma
in
fire.Fire(MyFire)
File "C:\Python37\lib\site-packages\fire\core.py", line 127, in Fire
component_trace = Fire(component, args, context, name)
File "C:\Python37\lib\site-packages\fire\core.py", line 366, in Fire
component, remaining_args)
File "C:\Python37\lib\site-packages\fire\core.py", line 542, in CallCallable
result = fn(*varargs, **kwargs)
File "C:\Python37\lib\site-packages\uiautomator2_main.py", line 331, in in
it
ignore_apk_check)
File "C:\Python37\lib\site-packages\uiautomator2_main.py", line 356, in i
nit_with_serial
ins.install_atx_agent(agent_version, reinstall)
File "C:\Python37\lib\site-packages\uiautomator2_main.py", line 242, in in
stall_atx_agent
path = cache_download(url)
File "C:\Python37\lib\site-packages\uiautomator2_main.py", line 78, in cac
he_download
raise Exception("status code", r.status_code)
Exception: ('status code', 404)
上周搭建好环境的时候,server 页面还能加载,今天就完全不行了。 运行报错:
\atx-server.exe --port 8060
运行看到有打印信息:
C:/Go/src/net/http/server.go:1847 +0x64d
created by net/http.(*Server).Serve
C:/Go/src/net/http/server.go:2851 +0x2fc
2019/01/22 17:27:47 http: panic serving [::1]:4585: html/template: pattern matches no files: templates/*.html
goroutine 61 [running]:
net/http.(*conn).serve.func1(0xc000164500)
C:/Go/src/net/http/server.go:1746 +0xd7
看了是找不到html 文件,有去文件下检查,的确也没有,这个改如何解决呢?
adb connect
@mingyuan-xia 请问下,源码中的Product 和 Provider的相关代码是遗留代码吗,是不已经被Device取代不再使用
请问下需要本地的apk包怎么可以上传到远端的设备呢?
安卓版本7.1.2(25)
C:\Users\Administrator>python -m uiautomator2 init 10.0.1.1:8000
2018-05-08 14:26:59,427 - main.py:254 - INFO - atx-server addr 10.0.1.1:8000
2018-05-08 14:26:59,506 - main.py:269 - INFO - Detect pluged devices: ['980f
5397']
2018-05-08 14:26:59,507 - main.py:286 - INFO - Device(980f5397) initialing .
..
�[Kminicap.so |################################| 13.2K / 13.2K
�[?25h2018-05-08 14:27:09,736 - main.py:113 - INFO - install minicap
�[Kminicap |################################| 357.9K / 357.9K
�[?25h2018-05-08 14:27:22,467 - main.py:120 - INFO - install minitouch
�[Kminitouch |################################| 29.5K / 29.5K
�[?25h2018-05-08 14:27:27,442 - main.py:143 - INFO - app-uiautomator.apk(1.0
.13) installing ...
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in u
rlopen
chunked=chunked)
File "C:\Python36\lib\site-packages\urllib3\connectionpool.py", line 387, in _
make_request
six.raise_from(e, None)
File "", line 2, in raise_from
File "C:\Python36\lib\site-packages\urllib3\connectionpool.py", line 383, in _
make_request
httplib_response = conn.getresponse()
File "C:\Python36\lib\http\client.py", line 1331, in getresponse
response.begin()
File "C:\Python36\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "C:\Python36\lib\http\client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Python36\lib\site-packages\urllib3\connectionpool.py", line 639, in u
rlopen
_stacktrace=sys.exc_info()[2])
File "C:\Python36\lib\site-packages\urllib3\util\retry.py", line 357, in incre
ment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Python36\lib\site-packages\urllib3\packages\six.py", line 685, in rer
aise
raise value.with_traceback(tb)
File "C:\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in u
rlopen
chunked=chunked)
File "C:\Python36\lib\site-packages\urllib3\connectionpool.py", line 387, in _
make_request
six.raise_from(e, None)
File "", line 2, in raise_from
File "C:\Python36\lib\site-packages\urllib3\connectionpool.py", line 383, in _
make_request
httplib_response = conn.getresponse()
File "C:\Python36\lib\http\client.py", line 1331, in getresponse
response.begin()
File "C:\Python36\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "C:\Python36\lib\http\client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Re
mote end closed connection without response',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python36\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "C:\Python36\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Python36\lib\site-packages\uiautomator2_main.py", line 352, in
main()
File "C:\Python36\lib\site-packages\uiautomator2_main.py", line 348, in ma
in
fire.Fire(MyFire)
File "C:\Python36\lib\site-packages\fire\core.py", line 127, in Fire
component_trace = Fire(component, args, context, name)
File "C:\Python36\lib\site-packages\fire\core.py", line 366, in Fire
component, remaining_args)
File "C:\Python36\lib\site-packages\fire\core.py", line 542, in CallCallable
result = fn(*varargs, **kwargs)
File "C:\Python36\lib\site-packages\uiautomator2_main.py", line 273, in in
it
ignore_apk_check)
File "C:\Python36\lib\site-packages\uiautomator2_main.py", line 291, in i
nit_with_serial
ins.install_uiautomator_apk(apk_version, reinstall)
File "C:\Python36\lib\site-packages\uiautomator2_main.py", line 144, in in
stall_uiautomator_apk
path = cache_download(app_url)
File "C:\Python36\lib\site-packages\uiautomator2_main.py", line 73, in cac
he_download
r = requests.get(url, stream=True)
File "C:\Python36\lib\site-packages\requests\api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "C:\Python36\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python36\lib\site-packages\requests\sessions.py", line 508, in reques
t
resp = self.send(prep, **send_kwargs)
File "C:\Python36\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Python36\lib\site-packages\requests\adapters.py", line 490, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected(
'Remote end closed connection without response',))
增加远程logcat 功能,可支持 包名 和 activity 进行过滤
连接设备操作后设备状态未变,导致第二个人也连接就会看到全是黑的,无法操作。
ATX-Server部署在服务器A上上,用电脑B打开控制界面,远程真机,可否开发一个功能从B电脑上传APK安装到相应手机上
我想在控制页面增加一个远程唤醒的功能,如WOL(Wake On Lan),但是要实现这个功能需要发送UDP广播,我对前端不是太了解,想请问下有没有什么方式可以实现在控制页面发送UDP广播呢?谢谢!
server也起来了,init也成功了 ,网络也能ping通的 ,杀毒软件 防火墙之类的也关了,手机上允许USB模拟权限开启了,更换过一台设备但是网页上还是没有出现设备。
$ curl 127.0.0.1:8000/list null
PC:windows 10
手机:小米5s\红米note5
请老师帮忙分析一下原因,另外,文档中提到的API,我从哪里可以看到并编辑呢?
$ curl $SERVER_URL/list [ { "udid": "741AEDR42P6YM-2c:57:31:4b:40:74-M2_E", "ip": "10.240.218.20", "present": true, "ready": true, "using": true, "provider": null, "serial": "741AEDR42P6YM", "brand": "Meizu", "model": "M2 E", "hwaddr": "2c:57:31:4b:40:74", "agentVersion": "0.1.1", "battery": {}, "display": { "width": 1080, "height": 1920 } } ]
1、atx-server绑定的ip变化之后,之前平台上的设备仍然存在并且可以操作,为什么不需要重新绑定到新的IP地址?
2、设备因为电量不足自动关机,但是atx-server上仍然显示这些设备在线,present 仍然显示为True,怎么将这些设备清除,正确显示在线的设备?
用docker-compose构建好容器环境,然后使用命令:
python -m uiautomator2 init atxserver-addr
将手机注册到服务器上。
设备列表显示的不是手机的真实ip而是docker容器的网关IP
Note:
Phone IP: 10.2.200.89
Mac IP: 10.2.200.84
Phone: Samsung Galaxy A5
Android Version: 6.0.1
atx-agent log:
2018/05/24 08:01:12 main.go:1287: Ignore SIGHUP
2018/05/24 08:01:12 main.go:1291: Kill server
2018/05/24 08:01:12 main.go:1294: wait previous server stopped
atx-agent version 0.3.2
Listen on http://10.2.200.156:7912
2018/05/24 08:01:15 cmdctrl.go:27: DEBUG start args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner], env: []
2018/05/24 08:01:15 cmdctrl.go:27: DEBUG program pid: 9146
2018/05/24 08:01:15 main.go:745: rotation change received: 0
2018/05/24 08:01:15 cmdctrl.go:27: DEBUG cmd args: [/data/local/tmp/minicap -S -P 720x1280@800x800/0]2018/05/24 08:01:16 main.go:745: rotation change received: 0
2018/05/24 08:01:16 cmdctrl.go:27: DEBUG cmd args: [/data/local/tmp/minicap -S -P 720x1280@800x800/0]
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
com.github.uiautomator.stub.Stub:
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: test=testUIAutomatorStub
INSTRUMENTATION_STATUS: class=com.github.uiautomator.stub.Stub
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS_CODE: 1
2018/05/24 08:01:21 heartbeat.go:171: heatbeat err: post form: Post http://10.2.200.84:8000/heartbeat: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers), retry after 14s
2018/05/24 08:01:40 heartbeat.go:171: heatbeat err: post form: Post http://10.2.200.84:8000/heartbeat: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers), retry after 13s
2018/05/24 08:01:58 heartbeat.go:171: heatbeat err: post form: Post http://10.2.200.84:8000/heartbeat: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers), retry after 12s
2018/05/24 08:02:15 heartbeat.go:171: heatbeat err: post form: Post http://10.2.200.84:8000/heartbeat: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers), retry after 13s
2018/05/24 08:02:33 heartbeat.go:171: heatbeat err: post form: Post http://10.2.200.84:8000/heartbeat: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers), retry after 12s
2018/05/24 08:02:50 heartbeat.go:171: heatbeat err: post form: Post http://10.2.200.84:8000/heartbeat: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers), retry after 10s
2018/05/24 08:03:05 heartbeat.go:171: heatbeat err: post form: Post http://10.2.200.84:8000/heartbeat: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers), retry after 11s
2018/05/24 08:03:21 heartbeat.go:171: heatbeat err: post form: Post http://10.2.200.84:8000/heartbeat: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers), retry after 13s
希望增加远程后台功能,手机跟server端不再一个网段 也可连接
C:\Users\Administrator>go get -v github.com/openatx/atx-server
github.com/openatx/atx-server
go\src\github.com\openatx\atx-server\httpserver.go:397:5: hbs.OnReconnect undefi
ned (type *heartbeat.Server has no field or method OnReconnect)
我的手机重启后,打开uiautomator的app,通过浏览器打开链接也连接不上机器,是不是需要adb在哪个目录下重启下手机里的服务?
日志:
liyudeMacBook-Pro:atx-server liyu$ go build
../../../gopkg.in/gorethink/gorethink.v4/connection_handshake.go:17:2: cannot find package "golang.org/x/crypto/pbkdf2" in any of:
/usr/local/go/src/golang.org/x/crypto/pbkdf2 (from $GOROOT)
/Users/liyu/go/src/golang.org/x/crypto/pbkdf2 (from $GOPATH)
../../sirupsen/logrus/terminal_check_notappengine.go:9:2: cannot find package "golang.org/x/crypto/ssh/terminal" in any of:
/usr/local/go/src/golang.org/x/crypto/ssh/terminal (from $GOROOT)
/Users/liyu/go/src/golang.org/x/crypto/ssh/terminal (from $GOPATH)
../../cenkalti/backoff/context.go:6:2: cannot find package "golang.org/x/net/context" in any of:
/usr/local/go/src/golang.org/x/net/context (from $GOROOT)
/Users/liyu/go/src/golang.org/x/net/context (from $GOPATH)
../../sirupsen/logrus/terminal_bsd.go:6:8: cannot find package "golang.org/x/sys/unix" in any of:
/usr/local/go/src/golang.org/x/sys/unix (from $GOROOT)
/Users/liyu/go/src/golang.org/x/sys/unix (from $GOPATH)
liyudeMacBook-Pro:atx-server liyu$
Hi sir,
I am reading the code. Got into some confuse, could u kindly help me?
https://github.com/openatx/atx-server/blob/master/templates/remote.html#L70
When close a tab, the device is auto released. And using filed in the device info is updated in db, then the index page can update the device using status.
Here what I don't understand is I don't see any release api called when closing the tab, how is the using filed updated.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.