openatx / android-uiautomator-server Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
是否可以在UI做一个打开atx-agent服务进程的按键?
shell on summary note 8
#./atx-agent server -d
this show message:
INFO[0000] run atx-agent in background
panic: runtime error: slice bounds out of range [1:0] [recovered]
panic: runtime error: slice bounds out of range [1:0]
goroutine 1 [running]:
encoding/json.(*encodeState).marshal.func1(0x14aaafc)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:305 +0x8c
panic(0x524520, 0x1418650)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/panic.go:679 +0x194
reflect.(*rtype).String(0x514aa0, 0x32c9ac, 0x141864c)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/reflect/type.go:763 +0xac
reflect.(*rtype).Name(0x514aa0, 0x0, 0x0)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/reflect/type.go:878 +0x28
encoding/json.typeFields(0x640568, 0x5414c0, 0x5414c0, 0x0, 0x0, 0x0)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:1133 +0x398
encoding/json.cachedTypeFields(0x640568, 0x5414c0, 0x999328, 0xe9d32000, 0x4e0f40, 0x140ee40)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:1278 +0xbc
encoding/json.newStructEncoder(0x640568, 0x5414c0, 0x4e96b8)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:674 +0x24
encoding/json.newTypeEncoder(0x640568, 0x5414c0, 0x541401, 0x4e0f40)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:425 +0x2e8
encoding/json.typeEncoder(0x640568, 0x5414c0, 0x5414c0)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:381 +0x14c
encoding/json.newPtrEncoder(0x640568, 0x540340, 0x4e96b8)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:814 +0x38
encoding/json.newTypeEncoder(0x640568, 0x540340, 0x540301, 0x4e0f40)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:433 +0x284
encoding/json.typeEncoder(0x640568, 0x540340, 0x16)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:381 +0x14c
encoding/json.valueEncoder(0x540340, 0x1477420, 0x16, 0x7)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:355 +0x48
encoding/json.(*encodeState).reflectValue(0x14b54a0, 0x540340, 0x1477420, 0x16, 0x990100)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:337 +0x2c
encoding/json.(*encodeState).marshal(0x14b54a0, 0x540340, 0x1477420, 0x100, 0x0, 0x0)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/encode.go:309 +0xe4
encoding/json.(*Encoder).Encode(0x1449bb0, 0x540340, 0x1477420, 0x3, 0x4)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/json/stream.go:202 +0x58
github.com/sevlyar/go-daemon.(*Context).parent(0x1477420, 0x141e150, 0x0, 0x0)
/home/travis/gopath/pkg/mod/github.com/sevlyar/[email protected]/daemon_unix.go:107 +0x26c
github.com/sevlyar/go-daemon.(*Context).reborn(0x1477420, 0x0, 0x0, 0x1a4)
/home/travis/gopath/pkg/mod/github.com/sevlyar/[email protected]/daemon_unix.go:59 +0x80
github.com/sevlyar/go-daemon.(*Context).Reborn(...)
/home/travis/gopath/pkg/mod/github.com/sevlyar/[email protected]/daemon.go:31
main.runDaemon(0x1456a80)
/home/travis/gopath/src/github.com/openatx/atx-agent/main.go:388 +0xa4
main.main()
/home/travis/gopath/src/github.com/openatx/atx-agent/main.go:595 +0x14ac
run python :
D:\>python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import uiautomator2 as u2
>>> d = u2.connect("xxxf3f037e")
>>> d.info
[W 220725 18:38:33 __init__:218] [pid:7092] atx-agent has something wrong, auto recovering
[D 220725 18:38:33 __init__:317] [pid:7092] [xxxf3f037e] device xxxf3f037e is online
[I 220725 18:38:34 init:156] uiautomator2 version: 2.16.18
[D 220725 18:38:34 init:167] Shell: ('/data/local/tmp/atx-agent', 'server', '--stop')
[D 220725 18:38:34 init:295] Real version: [0, 10, 0], Expect version: [0, 10, 0]
[D 220725 18:38:34 init:167] Shell: ('/data/local/tmp/atx-agent', 'server', '--nouia', '-d', '--addr', '127.0.0.1:7912')
[I 220725 18:38:34 init:350] Check atx-agent version
[D 220725 18:38:34 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
[D 220725 18:38:35 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
[D 220725 18:38:35 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
[D 220725 18:38:36 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
[D 220725 18:38:36 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
[D 220725 18:38:37 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
[D 220725 18:38:37 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
[D 220725 18:38:38 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
[D 220725 18:38:38 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
[D 220725 18:38:39 init:359] Forward: local:tcp:50713 -> remote:tcp:7912
Traceback (most recent call last):
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1322, in getresponse
response.begin()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 303, in begin
version, status, reason = self._read_status()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 272, 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:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\util\retry.py", line 532, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\packages\six.py", line 734, in reraise
raise value.with_traceback(tb)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1322, in getresponse
response.begin()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 303, in begin
version, status, reason = self._read_status()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 272, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uiautomator2\__init__.py", line 444, in info
return self.jsonrpc.deviceInfo(http_timeout=10)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uiautomator2\__init__.py", line 475, in __call__
return self.server._jsonrpc_retry_call(self.method, params,
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uiautomator2\__init__.py", line 482, in _jsonrpc_retry_call
return self._jsonrpc_call(*args, **kwargs)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uiautomator2\__init__.py", line 508, in _jsonrpc_call
res = self.http.post("/jsonrpc/0",
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 590, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uiautomator2\__init__.py", line 223, in request
self.__client._prepare_atx_agent()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uiautomator2\__init__.py", line 324, in _prepare_atx_agent
self._setup_atx_agent()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uiautomator2\__init__.py", line 334, in _setup_atx_agent
_initer.setup_atx_agent()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uiautomator2\init.py", line 351, in setup_atx_agent
self.check_atx_agent_version()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\retry\api.py", line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\retry\api.py", line 33, in __retry_internal
return f()
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uiautomator2\init.py", line 360, in check_atx_agent_version
version = requests.get("http://%s:%d/version" %
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\dxx\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
`
so, what's wrong? please help me
在AutomatorService
添加两个接口如下:
void setClipboard(String label, String text);
String getClipboard();
查看ClipData api文档之后发现会有5中数据类型可以放在粘贴板中,目前直接做一种还是全部都需要实现
具体使用的demo 可以看这里
Hey @codeskyblue
Thanks for maintaining the app! It is quite a handy tool!
I am building an app using it but stucking at missing 'd.parent()' method when trying to access the node's parent. So i want to implemente this method.
From the code of uiautomator2, the python wrapper, it is commented that it has to implement a 'parent' method in this android-uiautomator-server app.
I tried to see where the code is located. It seems it should be in stub/Selector.java.
Reading this class, I got confused by 'getChildOrSibling'.
But to be honest, I don't really know what I am doing , I was hoping to write some 'parralle' function, something like child(), but there's no such method...and I got lose...
To fiture it out, I have some questions regarding the function calling processes and I am hoping you can help me to understand them and I can start to contribute as well, if you have time :)
I setted d.debug to true from python uiautomator2 and I saw the all the requests and responses. And I can see there's 'method' field. And after sending it to androiud-uiautomater-server, how does the server accept the request? Where is the server accepting point?
I cloned the project to my local env and tried to build it. I followed the build session from README.md
At the project root, I did
$ ./gradlew build
$ ./gradlew packageDebugAndroidTest
No error so far.
But running ./gradlew cC, the terminal stucked at
<============-> 95% EXECUTING [2m 53s]
> :app:connectedDebugAndroidTest
Is this normal?
And I open another terminal to run:
adb forward tcp:9008 tcp:9008 # tcp forward
and then
adb shell am broadcast -a ADB_INPUT_TEXT --es text SGVsbG8g5L2g5aW9
But the text field in my app didn't have any text inserted.
So, I am not sure if I build sucessfully or not.
Also I changed one method in Selector.java
public String getText() {
Log.d("should always return this text");
return "should always return this text";
}
So when I send a d(xx).get_text(), it should always got the given texts. However that's not what happed.
I am not sure if it's a build issue or this is just not how it
Other than these two questions, if you have any insight you want to share, please let me know.
Thanks again for your time.
Ran
app-uiautomator客户端,点击启动uiautomator时,会提示启动成功,但过两三秒,app就闪退。
重启app还是显示 uiautomator stopped。
说明:
1、用release 2.0.4的打好的包,启动ua服务会闪退,但重启app显示已启动。uiautomator服务不稳定,跑一两个用例就stopped了
2、用源码debug,启动ua服务会闪退,重启app依然显示stopped
3、atx-agent用的是默认安装版本
4、经过调试,startUiautomator是执行成功的,但过两三秒app就闪退,也捕获不到异常信息;
5、以上测试机型:华为荣耀10青春版、红米6、红米6、360
猜测原因:src/androidTest/java/com/github/uiautomator/stub/Selector.java: 157 ~ 166
public BySelector toBySelector() {
BySelector s = null;
if ((getMask() & Selector.MASK_CHECKABLE) > 0 && android.os.Build.VERSION.SDK_INT >= 18)
s = By.checkable(this.isCheckable());
if ((getMask() & Selector.MASK_CHECKED) > 0) {
if (s == null)
s = By.checked(isChecked());
else
s = s.checkable(isChecked()); // 猜测是行的函数调用错了?应该是s.checked?
}
I want to modify the app little bit.I want to translate that in English. As I think UIautomator2 is verifying signatures and stuffs I think If I will simply modify the package Uiautomator2 will not work because signature will be changed. so how can I make work to accept modified atx app? please guide me for this. It's important for me.
Run the jsonrcp server on Android device 应该改为
Run the AutomatorHttpServer on Android device,AutomatorHttpServer将部分请求转发给jsonrcp server处理。jsonrcp server实际上代理了uiautomator
Checking the license for package Solver for ConstraintLayout 1.0.2 in /usr/local/android-sdk/licenses
build.gradle里面的依赖是
compile 'com.android.support.constraint:constraint-layout:1.0.2'
暂时是将该依赖去除了
运行时抛出错误,复现方法不具体
相关代码
/**
* Check if view exists. This methods performs a waitForExists(long) with zero timeout. This basically returns immediately whether the view represented by this UiObject exists or not.
*
* @param obj the ui object.
* @return true if the view represented by this UiObject does exist
*/
@Override
public boolean exist(Selector obj) {
if (obj.getChildOrSibling().length == 0 && obj.toBySelector() != null)
return device.wait(Until.hasObject(obj.toBySelector()), 0L);
return device.findObject(obj.toUiSelector()).exists();
}
Trace内容
uiautomator2.JsonRpcError: -32001 Jsonrpc error: <java.lang.NullPointerException> data: java.lang.NullPointerException
at android.support.test.uiautomator.ByMatcher.findMatches(ByMatcher.java:142)
at android.support.test.uiautomator.ByMatcher.findMatches(ByMatcher.java:111)
at android.support.test.uiautomator.ByMatcher.findMatch(ByMatcher.java:72)
at android.support.test.uiautomator.UiDevice.hasObject(UiDevice.java:154)
at android.support.test.uiautomator.Until$2.apply(Until.java:55)
at android.support.test.uiautomator.Until$2.apply(Until.java:52)
at android.support.test.uiautomator.WaitMixin.wait(WaitMixin.java:40)
at android.support.test.uiautomator.WaitMixin.wait(WaitMixin.java:34)
at android.support.test.uiautomator.UiDevice.wait(UiDevice.java:187)
at com.github.uiautomator.stub.AutomatorServiceImpl.exist(AutomatorServiceImpl.java:744)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467)
at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352)
at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283)
at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251)
at com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100)
at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244)
at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)
at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
at java.lang.Thread.run(Thread.java:841)
app-uiautomator-test.apk 的源码没有吗?
Hi,
I'm using your app and I can't copy CLIPBOARD from the device to a non-rooted device
Please help me check, thank you very much ^^!
java.lang.NoSuchMethodException: android.os.Process.setArgV0(java.lang.String)
at java.lang.Class.getMethod(Class.java:1786)
at com.github.uiautomator.ScreenClient.setArgV0(ScreenClient.java:37)
at com.github.uiautomator.ScreenClient.main(ScreenClient.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)
java.lang.ClassNotFoundException: android.view.SurfaceControl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.github.uiautomator.ScreenHttpServer.initialize(ScreenHttpServer.java:49)
at com.github.uiautomator.ScreenClient.main(ScreenClient.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)
when run ScreenClient main
请教下,有没有定位,点击滑动等操作的restapi?
除了python之外,想通过其他客户端(如java)来访问uiautomator-server. 因为比较多项目还是用appium java做的自动化,全部移植到python有点困难.
请教一下大佬们,如何判断节点是NAF节点的?它和哪些因素有关?
我现在有两部手机,系统版本一样,微信版本一样,测试小程序时,相同的节点,一部手机节点标记为NAF,另一部手机却没有,这是什么原因呢?
if ((getMask() & Selector.MASK_TEXTMATCHES) > 0) { if (s == null) s = By.text(Pattern.compile(getTextMatches())); else s = s.text(Pattern.compile(getTextMatches())); }
I checked this line, I found some articles for this: https://stackoverflow.com/questions/3651725/match-multiline-text-using-regular-expression
Can you please fix this?
目前项目中有一个adb静态注册的广播,目前安卓在8.0及之后的版本已经禁止了静态注册的行为,也就是说静态注册是没用的
,所以这块需要一个调整,但是我不是很清楚这个具体在哪里使用了.
如果改为动态注册,这样才atx app
不在运行的时候是没办法接收到相关的广播信息的
https://enterprise.githubsupport.com/hc/en-us/requests/944955
We use UIAutomator-2 as part of our automation environment for Infotainment Validation at General Motors. The headunits of future model year vehicle lines (currently worked on) have moved to x86_64 architecture.
We are having trouble installing the ATX-agent on these unit since it is not supported currently. The error flagged is as below:
"Install atx-agent 0.9.5
arch(['x86_64']) need to be supported yet, please report an issue in github"
“com.github.uiautomator.test”,需验证身份后安装
请输入账号“199****0452”的密码
在录屏已经开始的情况下
另外录屏正常启停的情况下,生成的MP4文件概率性(大约10%-20%)格式错误,无法打开,压缩同样抛出格式错误异常:moov atom not found
机型:荣耀8A、荣耀8C 安卓版本:Android 9
如下3行安卓java代码:
import androidx.test.uiautomator.UiDevice;
UiDevice ud = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
this._currentPackageName = ud.getCurrentPackageName();
https://github.com/openatx/android-uiautomator-server/blob/master/app/src/main/java/com/github/uiautomator/MainActivity.java#L73
for this line, set default theme to RED
, which will result in 1.0f brightness and battery-consuming.
Can help change to BLACK
?
The background is, some phones as Samsung brand, will offline in atx-server after the screen is off. The way to avoid offline is to keep the screen on all the time, but there is no such settings for Samsung phones. So alternative way is to start up the IdentifyActivity. The default setting is so battery consuming.
如题, 我想做一个功能,比如在atx app的界面上启动atx-agent,是否可行?
我试了一圈没有成功,提示权限问题,无法在app内运行可执行文件
另外atx界面上的「停止atx-agent」的功能并没有生效。
app-uiautomator-test.apk
app-uiautomator.apk
尝试打包发现不是那么回事,求解惑
我只想要电脑端获取到所有app的控件信息
12-12 13:14:50.280 3227 14995 I ActivityManager: Force stopping com.github.uiautomator appid=10185 user=0: from pid 26635
12-12 13:14:50.281 3227 14995 I ActivityManager: Killing 26589:com.github.uiautomator/u0a185 (adj 0): stop com.github.uiautomator,from pid 26635
12-12 13:14:50.282 3227 14995 W ActivityManager: Crash of app com.github.uiautomator running instrumentation ComponentInfo{com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner}
12-12 13:14:50.283 3227 21351 W Binder : Outgoing transactions from this process must be FLAG_ONEWAY
12-12 13:14:50.283 3227 21351 W Binder : java.lang.Throwable
12-12 13:14:50.283 3227 21351 W Binder : at android.os.BinderProxy.transact(Binder.java:744)
12-12 13:14:50.283 3227 21351 W Binder : at android.app.IInstrumentationWatcher$Stub$Proxy.instrumentationFinished(IInstrumentationWatcher.java:160)
12-12 13:14:50.283 3227 21351 W Binder : at com.android.server.am.InstrumentationReporter$MyThread.run(InstrumentationReporter.java:86)
12-12 13:14:50.283 3227 3242 W ActivityManager: Error shutting down UiAutomationConnection
12-12 13:14:50.283 3227 14995 I ActivityManager: Force stopping com.github.uiautomator appid=10185 user=0: finished inst
12-12 13:14:50.283 3227 21351 I ActivityManager: Failure reporting to instrumentation watcher: comp=ComponentInfo{com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner} results=Bundle[{shortMsg=Process crashed.}]
I was trying to clone and build this repository. After building and installing successfully, I try to use am instrument command to enable uiautomator, but keep getting the follow error. Can anyone help? All setting is the same as the original in this repository.
Permission Denial: starting instrumentation ComponentInfo{com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner} from pid=17992, uid=2000 not allowed because package com.github.uiautomator.test does not have a signature matching the target com.github.uiautomator
Any way to change longClick behavior do set a duration for it? the current value is not working for me
Hey @codeskyblue,
I have being using the lib for a while now and thanks for providing the handy lib and support!
However, I am facing a situation these days of not able to stop an exceuting a long task, something like 'scrollToEndOfTheContactList'.
The use case:
Python uiautomator sends a scrollToEnd request , then the uiautomator server sees the request and starts to execute it. But before it gets fully finished, the python uiautomator wants to stop it in order to do another request. The question is how to stop it without killing uiautomator server.
To my knowledge, I am not seeing how I could stop the executing task without killing the uiautomator and restart it. But killing it generates an exception on python uiautomator side('Uiautomation not connected' or 'GatewayError'). And this info is not enough to tell if this 'not connected' action is because I intentionally want to kill it or because it's really an exception causing by a temporary network issue.
This is important in some cases when you need to decide if you want to retry the task since it's just a temporary network issue and a retry will just fix it or you just want to let it go since you killed it yourself.
So if you know any other methods to stop an executing task without killing uiautomator server, can you share some insight?
这个工具的想法是很赞的,如果能做到不要adb 就更赞了~
09-30 15:01:08.601 7047 7047 E ActivityThread: Activity com.github.uiautomator.MainActivity has leaked ServiceConnection com.github.uiautomator.MainActivity$1@9d004a8 that was originally bound here
09-30 15:01:08.601 7047 7047 E ActivityThread: android.app.ServiceConnectionLeaked: Activity com.github.uiautomator.MainActivity has leaked ServiceConnection com.github.uiautomator.MainActivity$1@9d004a8 that was originally bound here
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1571)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1463)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1606)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.ContextImpl.bindService(ContextImpl.java:1558)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.content.ContextWrapper.bindService(ContextWrapper.java:685)
09-30 15:01:08.601 7047 7047 E ActivityThread: at com.github.uiautomator.MainActivity.onCreate(MainActivity.java:55)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.Activity.performCreate(Activity.java:7041)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.Activity.performCreate(Activity.java:7032)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1231)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.support.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:532)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2864)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.ActivityThread.-wrap11(Unknown Source:0)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.os.Handler.dispatchMessage(Handler.java:106)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.os.Looper.loop(Looper.java:164)
09-30 15:01:08.601 7047 7047 E ActivityThread: at android.app.ActivityThread.main(ActivityThread.java:6753)
09-30 15:01:08.601 7047 7047 E ActivityThread: at java.lang.reflect.Method.invoke(Native Method)
09-30 15:01:08.601 7047 7047 E ActivityThread: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)
09-30 15:01:08.601 7047 7047 E ActivityThread: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
09-30 15:01:08.602 1324 9317 W ActivityManager: Unbind failed: could not find connection for android.os.BinderProxy@11787a5
In newer uiautomator versions 2.1.2 onwards there is a new option which allow not to suppress accessibility services. Currently when this json prc server is running on device we cant execute any uiautomator command using adb e.g we cant run
adb shell uiautomator dump
If we use the following flag we might use the existing accessibility services without killing them
//FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES
this.uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation(UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES);
出现时机是,界面刚刷新的时候,resourceId有很低的概率无法获取到。
怀疑是 AccessibilityEventListener 影响的
https://github.com/openatx/android-uiautomator-server/blob/master/app/src/androidTest/java/com/github/uiautomator/stub/AccessibilityEventListener.java#L42
在xiaomi Note miui9平台下发生
Server error: Injecting to another application requires INJECT_EVENTS permission
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.