macaca-sample / sample-java Goto Github PK
View Code? Open in Web Editor NEWMacaca test sample for Java
License: MIT License
Macaca test sample for Java
License: MIT License
使用项目中的apk包,运行AndroidSampleTest抛出错误,
堆栈信息:
java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to com.alibaba.fastjson.JSONArray at macaca.client.commands.Context.getContexts(Context.java:27) at macaca.client.MacacaClient.contexts(MacacaClient.java:143) at macaca.client.AndroidSampleTest.switchToWebView(AndroidSampleTest.java:140) at macaca.client.AndroidSampleTest.test_case_1(AndroidSampleTest.java:101)
启动app后,第一次使用xpath定位可以定位到,点击到达第二个页面后,使用xpath定位就报错找不到这个元素了:java.lang.Exception: An element could not be located on the page using the given search parameters.
这个xpath是使用app-inspector定位,可以找到
porps.put("reuse", 0);关闭模拟器,重新打开并安装app
porps.put("reuse", 1);不关闭模拟器,并安装app
这里需要设置什么值,才不会重新安装app,我看appium上有个noreset参数
macaca/client/DesktopSampleTest.java 的注释里提到的URL链接 404 , 链接为 https://macacajs.github.io/desired-caps.html
copy源码之后,通过maven update project 无法下载 macacaclient。
运行最新的demo,对元素进行操作时,报错:
java.lang.Exception: An unknown server-side error occurred while processing the command.
log日志:
macaca-android.js:294:10 [master] pid:964 start app with: {"package":"com.github.android_app_bootstrap","activity":"com.github.android_app_bootstrap.activity.WelcomeActivity"}
responseHandler.js:49:14 [master] pid:964 Send HTTP Respone to Client[2017-11-24 18:00:09]: {"sessionId":"8beda65d-7ba5-4a93-9bec-8ae74277dc7c","status":0,"value":"{"app":"/Users/tinating/.macaca-temp/android_app_bootstrap-debug.apk","reuse":1,"platformName":"android","udid":"cd4f47b1"}"}
responseHandler.js:11:12 [master] pid:964 Recieve HTTP Request from Client[2017-11-24 18:00:09]: method: POST url: /wd/hub/session/8beda65d-7ba5-4a93-9bec-8ae74277dc7c/element, jsonBody: {"using":"id","value":"com.github.android_app_bootstrap:id/mobileNoEditText"}
restart UIAutomatorWD server
uiautomator-client.js:61:14 [master] pid:964 INSTRUMENTATION_RESULT: shortMsg=Process crashed.
uiautomator-client.js:61:14 [master] pid:964 INSTRUMENTATION_CODE: 0
uiautomator-client.js:61:14 [master] pid:964 INSTRUMENTATION_STATUS: numtests=1
uiautomator-client.js:61:14 [master] pid:964 INSTRUMENTATION_STATUS: stream=
com.macaca.android.testing.UIAutomatorWD:
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: test=MacacaTestRunner
INSTRUMENTATION_STATUS: class=com.macaca.android.testing.UIAutomatorWD
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS_CODE: 1
uiautomator-client.js:61:14 [master] pid:964 INSTRUMENTATION_STATUS: stream=
UIAutomatorWD->http://localhost:9001<-UIAutomatorWD
INSTRUMENTATION_STATUS_CODE: 0
UIAutomatorWD http server ready
proxy.js:55:14 [master] pid:964 Proxy: /wd/hub/session/8beda65d-7ba5-4a93-9bec-8ae74277dc7c/element:POST to http://127.0.0.1:9001/wd/hub/session/8beda65d-7ba5-4a93-9bec-8ae74277dc7c/element:POST with body: {"using":"id","value":"com.github.android_app_bootstrap:id/mobileNoEditText"}
proxy.js:85:20 [master] pid:964 Got response with status 200: {"status":0,"value":{"ELEMENT":"1"},"sessionId":null}
session.js:109:14 [master] pid:964 Send HTTP Respone to Client[2017-11-24 18:00:10]: {"status":0,"value":"{"ELEMENT":"1"}","sessionId":null}
responseHandler.js:11:12 [master] pid:964 Recieve HTTP Request from Client[2017-11-24 18:00:10]: method: POST url: /wd/hub/session/8beda65d-7ba5-4a93-9bec-8ae74277dc7c/element/1/value, jsonBody: {"value":["中文+Test+12345678"]}
restart UIAutomatorWD server
uiautomator-client.js:61:14 [master] pid:964 INSTRUMENTATION_RESULT: shortMsg=Process crashed.
uiautomator-client.js:61:14 [master] pid:964
INSTRUMENTATION_CODE: 0
uiautomator-client.js:61:14 [master] pid:964 INSTRUMENTATION_STATUS: numtests=1
uiautomator-client.js:61:14 [master] pid:964 INSTRUMENTATION_STATUS: stream=
com.macaca.android.testing.UIAutomatorWD:
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: test=MacacaTestRunner
INSTRUMENTATION_STATUS: class=com.macaca.android.testing.UIAutomatorWD
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS_CODE: 1
uiautomator-client.js:61:14 [master] pid:964 INSTRUMENTATION_STATUS: stream=
uiautomator-client.js:61:14 [master] pid:964
uiautomator-client.js:61:14 [master] pid:964 UIAutomatorWD->http://localhost:9001<-UIAutomatorWD
UIAutomatorWD http server ready
proxy.js:55:14 [master] pid:964 Proxy: /wd/hub/session/8beda65d-7ba5-4a93-9bec-8ae74277dc7c/element/1/value:POST to http://127.0.0.1:9001/wd/hub/session/8beda65d-7ba5-4a93-9bec-8ae74277dc7c/element/1/value:POST with body: {"value":["中文+Test+12345678"]}
uiautomator-client.js:61:14 [master] pid:964
INSTRUMENTATION_STATUS_CODE: 0
proxy.js:85:20 [master] pid:964 Got response with status 200: {"status":13,"value":"An unknown server-side error occurred while processing the command.","sessionId":"8beda65d-7ba5-4a93-9bec-8ae74277dc7c"}
session.js:109:14 [master] pid:964 Send HTTP Respone to Client[2017-11-24 18:00:13]: {"status":13,"value":""An unknown server-side error occurred while processing the command."","sessionId":"8beda65d-7ba5-4a93-9bec-8ae74277dc7c"}
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.