macacajs / nosmoke Goto Github PK
View Code? Open in Web Editor NEWA cross platform UI crawler which scans view trees then generate and execute UI test cases.
Home Page: https://macacajs.github.io/NoSmoke
License: MIT License
A cross platform UI crawler which scans view trees then generate and execute UI test cases.
Home Page: https://macacajs.github.io/NoSmoke
License: MIT License
运行环境:macbook pro node 版本 8.5.0 用的android模拟器
*************************************
* version 1.0.35 is outdate *
* run: npm i -g [email protected] *
*************************************
>> index.js:30:12 [master] pid:3333 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '10.205.20.20',
host: 'CNlqi-3.local',
loaded_time: '2017-10-12 13:13:13' }
>> middlewares.js:30:10 [master] pid:3333 base middlewares attached
>> router.js:118:10 [master] pid:3333 router set
(node:3333) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:3333) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:3333) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
>> webdriver sdk launched
>> responseHandler.js:24:12 [master] pid:3333 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformName":"android","deviceName":"192.168.59.101:5555","isWaitActivity":true,"app":"https://npmcdn.com/android-app-bootstrap@latest/android_app_bootstrap/build/outputs/apk/android_app_bootstrap-debug.apk"}}
>> session.js:60:10 [master] pid:3333 Creating session, sessionId: b62b131b-6b86-47d9-b21b-303c9e1dcb6c.
>> responseHandler.js:63:12 [master] pid:3333 Send Error Respone to Client: Error: Server responded with status code 404:
Cannot find module "/android_app_bootstrap/build/outputs" in package [email protected]
>> responseHandler.js:69:14 [master] pid:3333 Error: Server responded with status code 404:
Cannot find module "/android_app_bootstrap/build/outputs" in package [email protected]
at Response.getBody (/usr/local/lib/node_modules/macaca-cli/node_modules/http-response-object/index.js:34:15)
at downloadWithCache (/usr/local/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/common/helper.js:156:20)
at Object._.configApp (/usr/local/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/common/helper.js:188:15)
at Object.createDevice (/usr/local/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/session.js:26:18)
at createDevice.next (<anonymous>)
at onFulfilled (/usr/local/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at /usr/local/lib/node_modules/macaca-cli/node_modules/co/index.js:54:5
at Promise (<anonymous>)
at Object.co (/usr/local/lib/node_modules/macaca-cli/node_modules/co/index.js:50:10)
at Object.toPromise (/usr/local/lib/node_modules/macaca-cli/node_modules/co/index.js:118:63)
(node:3333) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:3333) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:3333) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:3333) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:3333) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
客户端报错
> [email protected] dev /Users/lqi/Documents/lqi/work/test/appium/macacatest/NoSmoke
> nodemon ./bin/nosmoke -s
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node ./bin/nosmoke -s`
udid: undefined
>> NoSmoke start at: http://10.205.20.20:5678
----> silent mode <-------
<-- GET /
{ stats:
{ suites: 0,
tests: 0,
passes: 3,
pending: 0,
failures: 0,
start: 2017-10-12T05:13:16.662Z,
passPercent: 50,
pendingPercent: 0,
other: 0,
hasOther: false,
skipped: 1,
hasSkipped: true,
duration: 14523,
end: 2017-10-12T05:13:16.662Z },
suites:
{ title: '',
ctx: {},
suites: [],
tests: [],
pending: [],
_beforeEach: [],
_beforeAll: [],
_afterEach: [],
_afterAll: [],
root: true,
_timeout: 2000,
_enableTimeouts: true,
_slow: 75,
_retries: -1,
delayed: false,
_events: { 'pre-require': [] },
_eventsCount: 1,
uuid: 'xxxxxxxxxxx',
fullFile: '',
file: '',
passes: [],
failures: [],
skipped: [],
totalTests: 0,
totalPasses: 0,
totalFailures: 0,
totalPending: 0,
totalSkipped: 0,
duration: 0,
_totalTime: 14523 },
current:
{ image: 'https://macacajs.github.io/macaca-logo/svg/monkey.svg',
list: [ [Object], [Object], [Object] ] } } { name: 'macaca-reporter',
fileName: 'index.html',
assetsInline: true,
dataAttr: 'data-output',
configAttr: 'config-output',
distDir: '/Users/lqi/Documents/lqi/work/test/appium/macacatest/NoSmoke',
socket: { server: 'http://10.205.20.20:56788' } }
>> reporter generated: /Users/lqi/Documents/lqi/work/test/appium/macacatest/NoSmoke/reports/index.html
--> GET / 200
socket connected
(node:3352) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): FetchError: invalid json response body at http://localhost:3456/wd/hub/session reason: Unexpected token S in JSON at position 0
(node:3352) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
<-- GET /favicon.ico
--> GET /favicon.ico 200
^[[1;9D^C%
crawler.config.yml配置
desiredCapabilities:
platformName: 'android'
deviceName: '192.168.59.101:5555'
isWaitActivity: true
# activity: 'LoginActivity'
app: 'https://npmcdn.com/android-app-bootstrap@latest/android_app_bootstrap/build/outputs/apk/android_app_bootstrap-debug.apk'
# 2. Crawling option
crawlingConfig:
platform: 'android'
targetElements:
loginAccount:
actionType : 2
searchValue : 'please input username'
actionValue : '中文+Test+12345678'
loginPassword:
actionType : 2
searchValue : 'please input password'
actionValue : '111111'
loginButton:
actionType : 1
searchValue : 'Login'
alertConfirm:
actionType : 1
searchValue : 'yes'
win10环境 利用cmd命令行执行的
`D:\NoSmoke>npm run dev
[email protected] dev D:\NoSmoke
nodemon ./bin/nosmoke -s
[nodemon] 1.11.0
[nodemon] watching: . any time, enter rs
[nodemon] starting node ./bin/nosmoke -s
udid: undefined
NoSmoke start at: http://169.254.209.237:5678
----> silent mode <-------
<-- GET /
{ stats:
{ suites: 0,
tests: 0,
passes: 3,
pending: 0,
failures: 0,
start: 2017-10-23T05:57:36.342Z,
passPercent: 50,
pendingPercent: 0,
other: 0,
hasOther: false,
skipped: 1,
hasSkipped: true,
duration: 14523,
end: 2017-10-23T05:57:36.342Z },
suites:
{ title: '',
ctx: {},
suites: [],
tests: [],
pending: [],
_beforeEach: [],
_beforeAll: [],
_afterEach: [],
_afterAll: [],
root: true,
_timeout: 2000,
_enableTimeouts: true,
_slow: 75,
_retries: -1,
delayed: false,
_events: { 'pre-require': [] },
_eventsCount: 1,
uuid: 'xxxxxxxxxxx',
fullFile: '',
file: '',
passes: [],
failures: [],
skipped: [],
totalTests: 0,
totalPasses: 0,
totalFailures: 0,
totalPending: 0,
totalSkipped: 0,
duration: 0,
_totalTime: 14523 },
current:
{ image: 'https://macacajs.github.io/macaca-logo/svg/monkey.svg',
list: [ [Object], [Object], [Object] ] } } { name: 'macaca-reporter',
fileName: 'index.html',
assetsInline: true,
dataAttr: 'data-output',
configAttr: 'config-output',
distDir: 'D:\NoSmoke',
socket: { server: 'http://169.254.209.237:56788' } }
reporter generated: D:\NoSmoke\reports\index.html
--> GET / 200
socket connected
(node:17832) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): FetchError: invalid json response body at http://localhost:3456/wd/hub/session reason: Unexpected token I in JSON at position 0`
`C:\Users\cmd>macaca server --verbose
index.js:18:12 [master] pid:2376 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '169.254.209.237',
host: 'cmd',
loaded_time: '2017-10-23 14:00:10' }
middlewares.js:17:10 [master] pid:2376 base middlewares attached
router.js:127:10 [master] pid:2376 router set
webdriver sdk launched
responseHandler.js:11:12 [master] pid:2376 Recieve HTTP Request from Client[2017-10-23 14:00:19]: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformName":"android","isWaitActivity":true,"activity":"LoginActivity","app":"https://npmcdn.com/android-app-bootstrap@latest/android_app_bootstrap/build/outputs/apk/android_app_bootstrap-debug.apk"}}
session.js:47:10 [master] pid:2376 Creating session, sessionId: 7fdde3a0-b039-45df-b4cc-75c0735a3d25.
get C:\Users\cmd.macaca-temp\android_app_bootstrap-debug.apk from cache
sha:9656cdf14170f899681bebe9d58a1de4
helper.js:208:12 [master] pid:2376 Using local app form C:\Users\cmd.macaca-temp\android_app_bootstrap-debug.apk
responseHandler.js:56:12 [master] pid:2376 Send Error Respone to Client: Error: Command failed: D:\Android\android-sdk-windows/platform-tools/adb -s 192.168.60.101:5555 shell "pm install -r "/data/local/tmp/com.macaca.android.testing""
Failure [-26: Package com.macaca.android.testing new target SDK 18 doesn't support runtime permissions but the old target SDK 25 does.]
responseHandler.js:62:14 [master] pid:2376 Error: Command failed: D:\Android\android-sdk-windows/platform-tools/adb -s 192.168.60.101:5555 shell "pm install -r "/data/local/tmp/com.macaca.android.testing""
Failure [-26: Package com.macaca.android.testing new target SDK 18 doesn't support runtime permissions but the old target SDK 25 does.]
at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Error: Command failed: D:\Android\android-sdk-windows/platform-tools/adb -s 192.168.60.101:5555 shell "pm install -r "/data/local/tmp/com.macaca.android.testing""
Failure [-26: Package com.macaca.android.testing new target SDK 18 doesn't support runtime permissions but the old target SDK 25 do .]
at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)`
默认配置改为了android的 也就是
desiredCapabilities:
platformName: 'android'
isWaitActivity: true
activity: 'LoginActivity'
app: 'https://npmcdn.com/android-app-bootstrap@latest/android_app_bootstrap/build/outputs/apk/android_app_bootstrap-debug.apk'
模拟器 用的是Genymotion 7.0.0 的系统镜像,API24
服务端报了一个如上日志的错,
Error: Command failed: D:\Android\android-sdk-windows/platform-tools/adb -s 192.168.60.101:5555 shell "pm install -r "/data/local/tmp/com.macaca.android.testing""
Failure [-26: Package com.macaca.android.testing new target SDK 18 doesn't support runtime permissions but the old target SDK 25 do
Support Android device/simulator multi-device concurrent execution.
Support iOS simulator multi-device-concurrent execution.
使用安卓真机测试时发现无法点击授权弹窗。查看发现授权弹窗的activity和首页activity不同。不知道是不是这个原因?有没有什么解决方法?
前提:配置了permissionPattern和autoAcceptAlerts: true
想用nosmoke做web-pc的遍历测试,发现会报错,最后定位到了common/logger.js中,
报错信息如下
TypeError: "file" argument must be a non-empty string
at normalizeSpawnArguments (child_process.js:384:11)
at exports.spawn (child_process.js:497:38)
at Object.exports.execFile (child_process.js:213:15)
at exports.exec (child_process.js:143:18)
at Logger.filterDeviceLogs (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/common/logger.js:62:16)
at EventEmitter.root.eventEmmiter.addListener (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/crawler/index.js:56:10)
at emitOne (events.js:116:13)
at EventEmitter.emit (events.js:211:7)
at WDClient.onSessionCreated (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/wd-client.js:54:21)
at that.send (/Users/zhengxu/Documents/software/npm/lib/node_modules/nosmoke/lib/wd-client.js:45:14)
-----> Crawling Finished: <-----
TypeError: "file" argument must be a non-empty string
注释掉index.js中的 logger.filterDeviceLogs(root.config);
可以正常运行nosmoke命令,配置文件中时对所有的 a标签进行点击操作,但是实际运行能打开页面,但是未发生点击操作,能帮忙个看下是什么问题吗?
环境:win10 ;android studio 3.0; java1.8; android sdk 27;
uiautomator-client.js:74:14 [master] pid:15996 INSTRUMENTATION_STATUS: stream=
UIAutomatorWD->http://localhost:9009<-UIAutomatorWD
INSTRUMENTATION_STATUS_CODE: 0
UIAutomatorWD http server ready
responseHandler.js:56:12 [master] pid:15996 Send Error Respone to Client: get apk mainifest failed with: TypeError: "file" argument must be a non-empty string
InternalServerError: Internal Server Error
at Object.throw (C:\Users\Administrator\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\koa\lib\context.js:91:23)
at Object.module.exports (C:\Users\Administrator\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\responseHandler.js:59:17)
at module.exports.throw ()
at onRejected (C:\Users\Administrator\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:81:24)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
跑30分钟就停止了,是否有时间设置参数
responseHandler.js:11:12 [master] pid:2487 Recieve HTTP Request from Client[2019-04-17 15:44:51]: method: POST url: /wd/hub/session/e0e6fa2e-68ed-423b-b2db-f669ea73eaeb/actions, jsonBody: {"actions":[{"type":"tap","x":361,"y":1003.5}]}
proxy.js:56:14 [master] pid:2487 Proxy: /wd/hub/session/:sessionId/accept_alert:POST to http://127.0.0.1:9001/wd/hub/session/:sessionId/accept_alert:POST with body: {}
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
uiautomator-client.js:119:12 [master] pid:2487 proxy.send except: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:56:14 [master] pid:2487 Proxy: /wd/hub/session/e0e6fa2e-68ed-423b-b2db-f669ea73eaeb/actions:POST to http://127.0.0.1:9001/wd/hub/session/e0e6fa2e-68ed-423b-b2db-f669ea73eaeb/actions:POST with body: {"actions":[{"type":"tap","x":361,"y":1003.5}]}
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
proxy.js:64:22 [master] pid:2487 UIAutomatorWD client proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9001
Hi 安装文件只能是.app的还是也可以支持.ipa ,然后安装的时候出现如下错误是什么原因,谢谢
port: 3456 was occupied, changed port: 3465
index.js:18:12 [master] pid:1936 webdriver server start with config:
{ port: 3465,
verbose: true,
always: true,
ip: '192.168.9.7',
host: 'Aarons-MacBook-Pro.local',
loaded_time: '2018-05-23 23:57:29' }
middlewares.js:17:10 [master] pid:1936 base middlewares attached
router.js:133:10 [master] pid:1936 router set
Macaca server started
responseHandler.js:11:12 [master] pid:1071 Recieve HTTP Request from Client[2018-05-23 23:57:35]: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformName":"iOS","deviceName":"iPhone 6","autoAcceptAlerts":true,"xcodeOrgId":"S6NQ524Y5V","xcodeSigningId":"iPhone Developer","bundleId":"com.maa.netTestDemo","app":"/Users/aaronyang/Downloads/netLibraryTextDemo.app","udid":"dfeb73710c93352847220dd9c8ff3bee8b176a13"}}
session.js:58:10 [master] pid:1071 Creating session, sessionId: 824de475-03eb-4072-a009-fde9a4a65f01.
helper.js:176:12 [master] pid:1071 Using local app form /Users/aaronyang/Downloads/netLibraryTextDemo.app
responseHandler.js:56:12 [master] pid:1071 Send Error Respone to Client: Error: 2018-05-23 23:57:40.746 ios-deploy[1940:43249] [ !! ] Timed out waiting for device.
responseHandler.js:62:14 [master] pid:1071 Error: 2018-05-23 23:57:40.746 ios-deploy[1940:43249] [ !! ] Timed out waiting for device.
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/macaca-ios/node_modules/[email protected]@ios-device/lib/helper.js:46:17)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:554:12)
Error: 2018-05-23 23:57:40.746 ios-deploy[1940:43249] [ !! ] Timed out waiting for device.
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/macaca-ios/node_modules/[email protected]@ios-device/lib/helper.js:46:17)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:554:12)
一 searchValue无法根据resource-id值找到元素?默认都是text属性找元素吗?
用这份androidTest.yml
也就是searchValue都是取的text属性的话 可以跑通。
`# 1. Initialization option
desiredCapabilities:
platformName: 'android'
udid: 45806625
app: '/home/cmd/app/acp4.7p.apk'
packages: 'com.sinacp.ggaicai'
activity: 'com.aicai.pluginhost.activity.MainActivity'
isWaitActivity: true
reuse: 3
testingPeriod: 36000
permissionPatterns: '["继续安装","下一步","好","允许","确定","我知道"]'
crawlingConfig:
platform: 'android'
targetElements:
INmy:
actionType: 1
searchValue : '我的'
loginUI:
actionType: 1
searchValue : '立即登录/注册'
loginAccount:
actionType: 2
searchValue : "手机号/用户名"
actionValue : 'mdc123123'
loginPassword:
actionType: 2
searchValue : "登录密码"
actionValue : '123123'
loginButton:
actionType: 1
searchValue : "登录"
clickTypes:
- 'android.widget.ImageView'
- 'android.widget.TextView'
- 'android.widget.Button'
editTypes:
- 'android.widget.EditText'
tabBarTypes:
- 'android.widget.TabWidget'`
但是全部换成或部分换成id属性的话却无法找到 不执行。
这份都两个 是用的text属性 可以找到并点击 但是后边的
searchValue : "com.sinacp.ggaicai:id/etUserName" 却无法找到并输入用户名。
`
desiredCapabilities:
platformName: 'android'
udid: 45806625
app: '/home/cmd/app/acp4.7p.apk'
packages: 'com.sinacp.ggaicai'
activity: 'com.aicai.pluginhost.activity.MainActivity'
isWaitActivity: true
reuse: 3
testingPeriod: 36000
permissionPatterns: '["继续安装","下一步","好","允许","确定","我知道"]'
crawlingConfig:
platform: 'android'
targetElements:
INmy:
actionType: 1
searchValue : '我的'
loginUI:
actionType: 1
searchValue : '立即登录/注册'
loginAccount:
actionType: 2
searchValue : "com.sinacp.ggaicai:id/etUserName"
actionValue : 'mdc123'
loginPassword:
actionType: 2
searchValue : "com.sinacp.ggaicai:id/etPwd"
actionValue : '123123'
loginButton:
actionType: 1
searchValue : "com.sinacp.ggaicai:id/tvLogin"
clickTypes:
- 'android.widget.ImageView'
- 'android.widget.TextView'
- 'android.widget.Button'
editTypes:
- 'android.widget.EditText'
tabBarTypes:
- 'android.widget.TabWidget'
`
二 testingPeriod: 36000 这个是测试执行时间 我这样应该是设置的 106060 也就是10分钟
但从上述两个androidTest.yml 效果来看,是执行完该节 targetElements: 后优先的后 就直接停止了。
附上第二个androidTest.yml 的执行日志 , 可以看到执行到 立即登录/注册 后 根据id值 com.sinacp.ggaicai:id/etUserName 就没有执行后续,然后找到了个 com.sinacp.ggaicai:id/ivBack 返回主页后 就自行结束 遍历了
`cmd@TR:~/scripts/NoSmoke/android$ nosmoke -c androidTest.yml --verbose
server.js:15:12 [master] pid:1863 server start with config:
{ port: 5678,
verbose: true,
config: 'androidTest.yml',
ip: '192.168.66.113',
host: 'TR',
loaded_time: '2018-01-11 14:38:22' }
udid: undefined
(node:1863) DeprecationWarning: 'root' is deprecated, use 'global'
<-- GET /
reporter generated: /home/cmd/scripts/NoSmoke/android/reports/2018-1-11-14-38-21-report.html
--> GET / 200
initialize crawler
{"index":"1","text":"我的","class":"android.widget.TextView","package":"com.sinacp.ggaicai","checkable":"false","checked":"false","clickable":"false","enabled":"true","focusable":"false","focused":"false","scrollable":"false","long-clickable":"false","password":"false","selected":"false","bounds":"[864,1971][1080,1980]","pathInParent":1,"xpath":"//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[5]/android.widget.TextView[1]","type":"android.widget.TextView"}
{"index":"1","text":"立即登录/注册","resource-id":"com.acp.main:id/tvAccount","class":"android.widget.TextView","package":"com.sinacp.ggaicai","checkable":"false","checked":"false","clickable":"false","enabled":"true","focusable":"false","focused":"false","scrollable":"false","long-clickable":"false","password":"false","selected":"false","bounds":"[237,303][558,370]","pathInParent":1,"xpath":"//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.support.v4.view.ViewPager[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.TextView[1]","type":"android.widget.TextView"}
reporter generated: /home/cmd/scripts/NoSmoke/android/reports/2018-1-11-14-38-21-report.html
<-- GET /2018-1-11-14-38-21/db2dfbb6-2954-4553-a287-ddbc7edb1ea8.png
--> GET /2018-1-11-14-38-21/db2dfbb6-2954-4553-a287-ddbc7edb1ea8.png 200
<-- GET /2018-1-11-14-38-21/80583105-af13-4ac3-a6d1-69ac232cc007.png
--> GET /2018-1-11-14-38-21/80583105-af13-4ac3-a6d1-69ac232cc007.png 200
<-- GET /2018-1-11-14-38-21/1c1cbfe7-428f-4b69-bbba-f606d16cfb91.png
--> GET /2018-1-11-14-38-21/1c1cbfe7-428f-4b69-bbba-f606d16cfb91.png 200
{"NAF":"true","index":"0","resource-id":"com.sinacp.ggaicai:id/ivBack","class":"android.widget.ImageView","package":"com.sinacp.ggaicai","checkable":"false","checked":"false","clickable":"true","enabled":"true","focusable":"false","focused":"false","scrollable":"false","long-clickable":"false","password":"false","selected":"false","bounds":"[0,116][116,232]","type":"android.widget.ImageView","pathInParent":1,"xpath":"//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]/android.widget.ImageView[1]"}
{"index":"1","text":"我的","class":"android.widget.TextView","package":"com.sinacp.ggaicai","checkable":"false","checked":"false","clickable":"false","enabled":"true","focusable":"false","focused":"false","scrollable":"false","long-clickable":"false","password":"false","selected":"false","bounds":"[864,1971][1080,1980]","pathInParent":1,"xpath":"//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[5]/android.widget.TextView[1]","type":"android.widget.TextView"}
-----> Crawling Finished: <-----
terminate due to timeout
reporter generated: /home/cmd/scripts/NoSmoke/android/reports/2018-1-11-14-38-21-report.html
`
macaca -v
2.1.12
nosmoke -v
2.0.4
nosmoke --server http://localhost:${SERVER_PORT} -c ${CONFIG_FILE}
(node:1551) UnhandledPromiseRejectionWarning: FetchError: request to http://localhost:3686/wd/hub/session failed, reason: socket hang up
at ClientRequest. (/Users/walvekar.anand/.nvm/versions/node/v11.2.0/lib/node_modules/nosmoke/node_modules/node-fetch/index.js:133:11)
at ClientRequest.emit (events.js:182:13)
at Socket.socketOnEnd (_http_client.js:433:9)
at Socket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1098:12)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
(node:1551) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1551) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Currently nosmoke
uses tesseract
as default text recognition, but tesseract
is not good at the recognition of Chinese, do you have any plan of abstracting OCR
module to use other identification tools, such as character recognition baidu-ocr?
ios-deploy
get /Users/wangpeng/.macaca-temp/ios-app-bootstrap.zip from cache
sha:d2e65bba467659ef610b369f2ee599c1
helper.js:193:14 [master] pid:11427 Unzipping local app form /Users/wangpeng/.macaca-temp/ios-app-bootstrap.zip
macaca-ios.js:222:10 [master] pid:11427 Get available devices [{"name":"iPhone 5s","udid":"2F5C437D-D23E-43D3-85C4-3DD199974B2A","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone 6","udid":"2EDE4DF4-977B-45DA-ACE8-CA74C00A6058","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone 6 Plus","udid":"B9422494-5343-47A9-9966-CE6CA1B51CF4","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone 6s","udid":"B70D6339-2A7B-4D10-B9CD-D2AC731C396A","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone 6s Plus","udid":"3448D13D-DE24-46DF-A141-104A45E79AAF","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone 7","udid":"480B904D-7FBE-44B4-A7F3-FADBA45B7DFE","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone 7 Plus","udid":"BB4F8BAA-24DD-4FED-8FA5-4C47532D810B","state":"Booted","available":true,"runtime":"iOS 12.2"},{"name":"iPhone 8","udid":"86FE6BAD-1914-4BA5-A3E9-CA3C0266CA59","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone 8 Plus","udid":"11318427-0031-4C5E-9A4F-AD186C160B6F","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone SE","udid":"E5E34E7C-CB0F-4879-90D5-2E0D098AFE8E","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone X","udid":"051293B5-B66F-4149-B533-35B561FECA27","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone Xs","udid":"46B103E0-BA9A-4572-8504-FE390EF1EF02","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone Xs Max","udid":"0D5B22DD-F87E-49C2-BBDD-15DDC49F14F3","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPhone Xʀ","udid":"B08886DD-84D1-4ED6-8779-658119D2C96B","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPad Air","udid":"A2671E67-E712-480B-89A8-D90965DEA80C","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"iPad Air 2","udid":"7D6B56B7-2869-4ADD-BFBE-F8F0433D87CF","state":"Shutdown","available":true,"runtime":"iOS 12.2"},{"name":"Apple TV","udid":"FE42076B-49AE-46A1-901D-FC44543E484D","state":"Shutdown","available":true,"runtime":"tvOS 12.2"},{"name":"Apple TV 4K","udid":"5D109336-8ACD-4DF0-8142-F3539365F37E","state":"Shutdown","available":true,"runtime":"tvOS 12.2"},{"name":"Apple Watch Series 2 - 38mm","udid":"5C19E6A7-8C86-4B72-B0FD-E96AFF9D7980","state":"Shutdown","available":true,"runtime":"watchOS 5.2"},{"name":"Apple Watch Series 2 - 42mm","udid":"04EA127A-412D-4656-970C-987375EDDE96","state":"Shutdown","available":true,"runtime":"watchOS 5.2"},{"name":"Apple Watch Series 3 - 38mm","udid":"387BB219-F030-487B-91AC-BA8334A6E3CA","state":"Shutdown","available":true,"runtime":"watchOS 5.2"},{"name":"Apple Watch Series 3 - 42mm","udid":"56E29884-5C75-4A3E-9B23-59CCBD2577F9","state":"Shutdown","available":true,"runtime":"watchOS 5.2"},{"name":"Apple Watch Series 4 - 40mm","udid":"DAD941D8-912D-466F-9B0F-9B2FEEE1CB84","state":"Shutdown","available":true,"runtime":"watchOS 5.2"},{"name":"Apple Watch Series 4 - 44mm","udid":"D718D658-DDC0-465F-8D96-2366067325B6","state":"Shutdown","available":true,"runtime":"watchOS 5.2"}]
responseHandler.js:56:12 [master] pid:11427 Send Error Respone to Client: Error: Device xjs is not available!
真机已通过usb与电脑相连,从log获取的机型全部都是模拟器
Error: Device xjs is not available!
at IOS.getSimulatorUdid (/usr/local/lib/node_modules/macaca-ios/lib/macaca-ios.js:233:11)
at IOS.getSimulatorUdid.next ()
at onFulfilled (/usr/local/lib/node_modules/macaca-cli/node_modules/co/index.js:65:19)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
desiredCapabilities:
platformName: 'iOS'
deviceName: 'xjs'
app: 'https://npmcdn.com/ios-app-bootstrap@latest/build/ios-app-bootstrap.zip'
crawlingConfig:
strategy: 'ocr'
platform: 'ios'
deviceType: 'iPhone 7 Plus'
triggers:
单独执行
ios-deploy -c
[....] Waiting up to 5 seconds for iOS device to be connected
[....] Found 0ad7efe57b474fa635fc773e3dcb7******* (D11AP, iPhone 7 Plus, iphoneos, arm64) a.k.a. 'xjs' connected through USB.
`>> use default chromedriver version!
chromedriver bin path: D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\macaca-chromedriver\exec\chromedriver2.20.exe
Starting ChromeDriver 2.20.353145 (343b531d31eeb933ec778dbcf7081628a1396067) on port 9515
Only local connections are allowed.
chromedriver starting success.
proxy.js:51:14 [master] pid:9584 Proxy: /status:GET to http://localhost:9515/wd/hub/status:GET with body:
proxy.js:59:16 [master] pid:9584 Got response with status 200: "{"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Windows NT","version":"10.0"}}}"
proxy.js:51:14 [master] pid:9584 Proxy: /session:POST to http://localhost:9515/wd/hub/session:POST with body: {"desiredCapabilities":{"platformName":"Desktop","browserName":"Chrome","url":"https://macacajs.github.io"}}
[18824:9580:1023/153914.374:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
DevTools listening on ws://127.0.0.1:12751/devtools/browser/d3b3b544-9d53-489e-b41a-bdfbdd0c0824
[18824:5524:1023/153914.553:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.587:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.597:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.605:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.615:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.628:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.637:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.644:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.654:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.661:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.673:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.682:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.694:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.707:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.714:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.724:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.738:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.746:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.761:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.782:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.796:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.808:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.824:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.839:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
[18824:5524:1023/153914.849:ERROR:persistent_memory_allocator.cc(815)] Corruption detected in shared-memory segment.
Error: chromedriver proxy error with: Error: read ECONNRESET
at Request.e [as _callback] (D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\macaca-chromedriver\lib\proxy.js:57:25)
at self.callback (D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\request\request.js:199:22)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.onRequestError (D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\request\request.js:821:8)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
macaca-chromedriver.js:168:18 [master] pid:9584 chromedriver exit with code: 3221225477, signal: null
proxy.js:51:14 [master] pid:9584 Proxy: /session:POST to http://localhost:9515/wd/hub/session:POST with body: {"desiredCapabilities":{"platformName":"Desktop","browserName":"Chrome","url":"https://macacajs.github.io"}}
Error: chromedriver proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9515
at Request.e [as _callback] (D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\macaca-chromedriver\lib\proxy.js:57:25)
at self.callback (D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\request\request.js:199:22)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.onRequestError (D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\request\request.js:821:8)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
proxy.js:51:14 [master] pid:9584 Proxy: /session:POST to http://localhost:9515/wd/hub/session:POST with body: {"desiredCapabilities":{"platformName":"Desktop","browserName":"Chrome","url":"https://macacajs.github.io"}}`
然后会循环一直报该段错误 一直循环报:
`Error: chromedriver proxy error with: Error: connect ECONNREFUSED 127.0.0.1:9515
at Request.e [as _callback] (D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\macaca-chromedriver\lib\proxy.js:57:25)
at self.callback (D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\request\request.js:199:22)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.onRequestError (D:\nodejs\node-global\node_modules\macaca-chrome\node_modules\request\request.js:821:8)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
proxy.js:51:14 [master] pid:9584 Proxy: /session:POST to http://localhost:9515/wd/hub/session:POST with body: {"desiredCapabilities":{"platformName":"Desktop","browserName":"Chrome","url":"https://macacajs.github.io"}}`
配置如下:
desiredCapabilities:
platformName: 'Desktop'
browserName: 'Chrome'
url: 'https://macacajs.github.io'
crawlingConfig:
clickTypes:
- 'a'
editTypes:
- 'input'
...
C:\Users\cmd>macaca doctor
macaca-doctor version: 2.0.3
Node.js checklist:
node env: D:\nodejs\node.exe
node version: v6.10.0
Android checklist:
JAVA version is 1.8.0_121
JAVA_HOME is set to C:\Program Files\Java\jdk1.8.0_121
ANDROID_HOME is set to D:\Android\android-sdk-windows
Platforms is set to D:\Android\android-sdk-windows\platforms\android-26
ADB tool is set to D:\Android\android-sdk-windows\platform-tools\adb.exe
GRADLE_HOME is set to D:\gradle-3.5
Installed driver list:
android: 2.0.40
chrome: 1.0.7
electron: 1.1.11
http://xudafeng.github.io/nodejs/events.html#events_events_eventemitter
"wolfy87-eventemitter": "^5.2.2", 可以去掉了
请大神抽空补充下,在某类似微信的app上执行,YML配置不够用。。
Nosmok 默认的chromedriver是macaca路径下的
use default chromedriver version!
chromedriver bin path: /opt/nodejs/lib/node_modules/macaca-chrome/node_modules/macaca-chromedriver/exec/chromedriver2.20
Starting ChromeDriver 2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b) on port 9515
Only local connections are allowed.
chromedriver starting success.
该driver 并不能打开我目前的chrome版本 63.0
但是我用py 的appium1.7.1 指定该driver是可以打开本地chrome浏览器的。
于是我在nosmoke的 desiredCapabilities:
platformName: 'Desktop'
chromedriverExecutable: '/home/cmd/Selenium/driver/chromedriver'
browserName: 'Chrome'
发现还是用的默认的 找了下macaca的 并未说明是否支持该类似参数。。。
比如进行到下单页面,必须点击同意协议才能点击下单这种场景
port: 5678 was occupied, changed port: 5680
server.js:15:12 [master] pid:13397 server start with config:
{ port: 5680,
verbose: true,
hooks: './public/hook.js',
config: './public/crawler.config.yml',
ip: '172.23.40.184',
host: 'yangxiaohuadeMacBook-Pro.local',
loaded_time: '2018-03-28 18:41:47' }
udid: undefined
配置文件没有进行修改过,就想运行下demo
用项目下面的默认设置,使用Android的配置,手机端无反应,请帮忙看下Log,谢谢了!
macaca server --verbose
index.js:18:12 [master] pid:5688 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '10.1.46.86',
host: 'MD01-PC',
loaded_time: '2017-09-15 15:15:36' }
middlewares.js:17:10 [master] pid:5688 base middlewares attached
router.js:127:10 [master] pid:5688 router set
webdriver sdk launched
responseHandler.js:11:12 [master] pid:5688 Recieve HTTP Request from Client[2017-09-15 15:15:49]: method: POST url: /w
/hub/session, jsonBody: {"desiredCapabilities":{"isWaitActivity":true,"activity":"LoginActivity","app":"https://npmcdn.c
m/android-app-bootstrap@latest/android_app_bootstrap/build/outputs/apk/android_app_bootstrap-debug.apk"}}
session.js:47:10 [master] pid:5688 Creating session, sessionId: b6b3d929-36ec-40ef-8cd5-5f4ea5f7ef09.
please run:npm install macaca-undefined -g
session.js:40:14 [master] pid:5688 Error: Cannot find module 'macaca-undefined'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\c
ntrollers\session.js:36:20)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\s
rver\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
responseHandler.js:56:12 [master] pid:5688 Send Error Respone to Client: Error: >> session.js:40:14 [master] pid:5688
rror: Cannot find module 'macaca-undefined'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\c
ntrollers\session.js:36:20)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\s
rver\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
responseHandler.js:62:14 [master] pid:5688 Error: >> session.js:40:14 [master] pid:5688 Error: Cannot find module 'mac
ca-undefined'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\c
ntrollers\session.js:36:20)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\s
rver\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
at Logger.error (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\xlogger\lib\xlogger.js:169:9)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\c
ntrollers\session.js:40:14)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\s
rver\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
at Object.toPromise (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:118:63)
at next (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:99:29)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:69:7)
Error: >> session.js:40:14 [master] pid:5688 Error: Cannot find module 'macaca-undefined'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server
controllers\session.js:36:20)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib
server\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
at Logger.error (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\xlogger\lib\xlogger.js:169:
)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server
controllers\session.js:40:14)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib
server\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
at Object.toPromise (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:118:63)
at next (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:99:29)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:69:7)
responseHandler.js:11:12 [master] pid:5688 Recieve HTTP Request from Client[2017-09-15 15:24:40]: method: POST url: /w
/hub/session, jsonBody: {"desiredCapabilities":{"isWaitActivity":true,"activity":"LoginActivity","app":"https://npmcdn.c
m/android-app-bootstrap@latest/android_app_bootstrap/build/outputs/apk/android_app_bootstrap-debug.apk"}}
session.js:47:10 [master] pid:5688 Creating session, sessionId: 956b3a22-833a-4d86-acb5-359397079129.
please run:npm install macaca-undefined -g
session.js:40:14 [master] pid:5688 Error: Cannot find module 'macaca-undefined'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\c
ntrollers\session.js:36:20)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\s
rver\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
responseHandler.js:56:12 [master] pid:5688 Send Error Respone to Client: Error: >> session.js:40:14 [master] pid:5688
rror: Cannot find module 'macaca-undefined'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\c
ntrollers\session.js:36:20)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\s
rver\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
responseHandler.js:62:14 [master] pid:5688 Error: >> session.js:40:14 [master] pid:5688 Error: Cannot find module 'mac
ca-undefined'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\c
ntrollers\session.js:36:20)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\s
rver\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
at Logger.error (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\xlogger\lib\xlogger.js:169:9)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\c
ntrollers\session.js:40:14)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\s
rver\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
at Object.toPromise (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:118:63)
at next (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:99:29)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:69:7)
Error: >> session.js:40:14 [master] pid:5688 Error: Cannot find module 'macaca-undefined'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server
controllers\session.js:36:20)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib
server\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
at Logger.error (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\xlogger\lib\xlogger.js:169:
)
at detectDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server
controllers\session.js:40:14)
at Object.createDevice (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib
server\controllers\session.js:10:18)
at next (native)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:65:19)
at C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:54:5
at Object.co (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:50:10)
at Object.toPromise (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:118:63)
at next (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:99:29)
at onFulfilled (C:\Users\MD01\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\co\index.js:69:7)
我使用的默认的配置,chrome和web-pc, 启动没有报错。
但是网站打开后一直不动,报告页面只是时间变化,其他没变化,是哪里没配对么?
Hello,
I am facing the following using when trying to run nosmoke on mac:
When I try to run the following command:
# initialize macaca server
macaca server --verbose &
# initialize nosmoke
nosmoke
I get this error:
Error: Cannot find module 'macaca-reporter/test/mock'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/USERNAME/.nvm/versions/node/v8.14.0/lib/node_modules/nosmoke/lib/server/router.js:14:17)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
I am running on:
日志如下:
4854 verbose lifecycle [email protected]~postinstall: CWD: /usr/local/Cellar/node/10.7.0/lib/node_modules/macaca-electron/node_modules/electron 4855 silly lifecycle [email protected]~postinstall: Args: [ '-c', 'node install.js' ] 4856 silly lifecycle [email protected]~postinstall: Returned: code: 1 signal: null 4857 info lifecycle [email protected]~postinstall: Failed to exec postinstall script 4858 timing action:postinstall Completed in 505ms 4859 verbose unlock done using /Users/lizhen/.npm/_locks/staging-b2a6911e3a26c659.lock for /usr/local/Cellar/node/10.7.0/lib/node_modules/.staging 4860 timing stage:rollbackFailedOptional Completed in 629ms 4861 timing stage:runTopLevelLifecycles Completed in 5311ms 4862 verbose stack Error: [email protected] postinstall:
node install.js4862 verbose stack Exit status 1 4862 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16) 4862 verbose stack at EventEmitter.emit (events.js:182:13) 4862 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 4862 verbose stack at ChildProcess.emit (events.js:182:13) 4862 verbose stack at maybeClose (internal/child_process.js:962:16) 4862 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5) 4863 verbose pkgid [email protected] 4864 verbose cwd /Users/lizhen/.npm/_logs 4865 verbose Darwin 17.7.0 4866 verbose argv "/usr/local/Cellar/node/10.7.0/bin/node" "/usr/local/bin/npm" "i" "macaca-electron" "-g" 4867 verbose node v10.10.0 4868 verbose npm v6.4.1 4869 error code ELIFECYCLE 4870 error errno 1 4871 error [email protected] postinstall:
node install.js4871 error Exit status 1 4872 error Failed at the [email protected] postinstall script. 4872 error This is probably not a problem with npm. There is likely additional logging output above. 4873 verbose exit [ 1, true ]
desiredCapabilities:
platformName: 'Desktop'
browserName: 'electron'
url: 'https://macacajs.github.io'
crawlingConfig:
clickTypes:
- 'a'
editTypes:
- 'input'
...
initialize crawler
(node:16108) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token < in JSON at position 0
1、运行命令后,模拟器上可以安装APK并打开APK,但是cmd提示直接遍历结束,如下:
--> GET /favicon.ico 200
initialize crawler
-----> Crawling Finished <-----
(node:4352) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: socketed.disconne
cted is not a function
2、我的配置文件如下,请帮忙看看是否有问题,谢谢:
desiredCapabilities:
deviceName: 'emulator-5554'
app: 'https://npmcdn.com/android-app-bootstrap@latest/android_app_bootstrap/build/outputs/apk/android_app_bootstrap-debug.apk'
platformName: android
crawlingConfig:
platform: 'Android'
targetElements:
loginAccount:
actionType : 2
searchValue : 'please input username'
actionValue : '中文+Test+12345678'
loginPassword:
actionType : 2
searchValue : 'please input password'
actionValue : '111111'
loginButton:
actionType : 1
searchValue : 'Login'
alertConfirm:
actionType : 1
searchValue : 'yes'
clickTypes:
iOS(模拟器)适配到自己的应用,nosmoke后,应用一直crash
生成的文件log:Assertion Failure: XCTestWDRunner.swift:31: Failed to launch com.enterprise.bianlifeng.customer: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.)
2018-09-05 16:58:27.088818+0800 XCTestWDUITests-Runner[32640:1879462] *** Terminating app due to uncaught exception '_XCTestCaseInterruptionException', reason: 'Interrupting test'
*** First throw call stack:
@SamuelZhaoY
desiredCapabilities:
platformName: 'Android'
browserName: 'Chrome'
url: 'https://www.baidu.com'
crawlingConfig:
platform: 'android'
targetElements:
SearchConetent:
actionType: 2
searchValue : 'kw'
actionValue : '中文+Test+Nosmoke'
Search:
actionType: 1
searchValue : 'su'
clickTypes:
- 'a'
editTypes:
- 'input'
...
就是执行到打开了模拟器的浏览器 server端日志 也看到发送了
responseHandler.js:49:14 [master] pid:23330 Send HTTP Respone to Client[2018-01-05 14:42:41]: {"sessionId":"05a57509-a047-47b1-9b18-7033c33ca6e3","status":0,"value":"{"platformName":"Android","browserName":"Chrome","url":"http://m.aicai.com/m/register.do?agentId=1&vt=5\"}"}
但是 并没有打开该网址 然后nosmoke端日志 就是一直刷新reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-5-14:42:30-report.html
附上日志:
macaca server Log
cmd@TR:~$ macaca server --verbose
index.js:18:12 [master] pid:23330 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '192.168.66.113',
host: 'TR',
loaded_time: '2018-01-05 14:42:23' }
middlewares.js:17:10 [master] pid:23330 base middlewares attached
router.js:133:10 [master] pid:23330 router set
webdriver sdk launched
responseHandler.js:11:12 [master] pid:23330 Recieve HTTP Request from Client[2018-01-05 14:42:31]: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformName":"Android","browserName":"Chrome","url":"http://m.aicai.com/m/register.do?agentId=1&vt=5"}}
session.js:47:10 [master] pid:23330 Creating session, sessionId: 05a57509-a047-47b1-9b18-7033c33ca6e3.
checking permissionPatterns: []
uiautomator-client.js:62:14 [master] pid:23330 INSTRUMENTATION_STATUS: numtests=1
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:62:14 [master] pid:23330 INSTRUMENTATION_STATUS: stream=
UIAutomatorWD->http://localhost:9007<-UIAutomatorWD
INSTRUMENTATION_STATUS_CODE: 0
UIAutomatorWD http server ready
macaca-android.js:303:10 [master] pid:23330 start app with: {"package":"com.android.browser","activity":".BrowserActivity"}
this.webviewVersion found 44 use it!
starting chromedriver service!
chromedriver bin path: /opt/nodejs/lib/node_modules/macaca-android/node_modules/macaca-chromedriver/exec/chromedriver2.20
Starting ChromeDriver 2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b) on port 9515
Only local connections are allowed.
chromedriver starting success.
proxy.js:51:14 [master] pid:23330 Proxy: /status:GET to http://localhost:9515/wd/hub/status:GET with body:
proxy.js:59:16 [master] pid:23330 Got response with status 200: "{"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Linux","version":"4.4.0-104-generic"}}}"
proxy.js:51:14 [master] pid:23330 Proxy: /session:POST to http://localhost:9515/wd/hub/session:POST with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.browser","androidUseRunningApp":true,"androidDeviceSerial":"192.168.58.101:5555"}}}
proxy.js:59:16 [master] pid:23330 Got response with status 200: {"sessionId":"80e9682ea5db3533c9126b348888c826","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{},"cssSel...
chromedriver ready with: {"sessionId":null,"status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":true,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"platform":"ANDROID","rotatable":false,"takesHeapSnapshot":true,"takesScreenshot":true,"version":"44.0.2403.119","webStorageEnabled":true}}
proxy.js:51:14 [master] pid:23330 Proxy: /wd/hub/session/:sessionId/window_handles:GET to http://localhost:9515/wd/hub/session/80e9682ea5db3533c9126b348888c826/window_handles:GET with body: {}
proxy.js:59:16 [master] pid:23330 Got response with status 200: {"sessionId":"80e9682ea5db3533c9126b348888c826","status":0,"value":["CDwindow-9564C0B4-4334-4A06-9D63-317CBDFD5D71"]}
responseHandler.js:49:14 [master] pid:23330 Send HTTP Respone to Client[2018-01-05 14:42:41]: {"sessionId":"05a57509-a047-47b1-9b18-7033c33ca6e3","status":0,"value":"{"platformName":"Android","browserName":"Chrome","url":"http://m.aicai.com/m/register.do?agentId=1&vt=5\"}"}
responseHandler.js:11:12 [master] pid:23330 Recieve HTTP Request from Client[2018-01-05 14:42:47]: method: GET url: /wd/hub/session/05a57509-a047-47b1-9b18-7033c33ca6e3/source, jsonBody: {}
proxy.js:51:14 [master] pid:23330 Proxy: /wd/hub/session/:sessionId/source:GET to http://localhost:9515/wd/hub/session/80e9682ea5db3533c9126b348888c826/source:GET with body: null
proxy.js:59:16 [master] pid:23330 Got response with status 200: "{"sessionId":"80e9682ea5db3533c9126b348888c826","status":0,"value":"\u003Chtml xmlns=\"http://www.w3.org/1999/xhtml\\\">\\u003Chead>\\u003C/head>\\u003Cbody>\\u003C/body>\\u003C/html>\"}"
responseHandler.js:49:14 [master] pid:23330 Send HTTP Respone to Client[2018-01-05 14:42:47]: {"sessionId":"05a57509-a047-47b1-9b18-7033c33ca6e3","status":0,"value":""<html xmlns=\"http://www.w3.org/1999/xhtml\\\">""}
nosmoke Log
cmd@TR:~/scripts/NoSmoke/web$ nosmoke -c H5Test.yml --verbose
server.js:15:12 [master] pid:23347 server start with config:
{ port: 5678,
verbose: true,
config: 'H5Test.yml',
ip: '192.168.66.113',
host: 'TR',
loaded_time: '2018-01-05 14:42:31' }
udid: undefined
(node:23347) DeprecationWarning: 'root' is deprecated, use 'global'
<-- GET /
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-5-14:42:30-report.html
--> GET / 200
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-5-14:42:30-report.html
initialize crawler
(node:23347) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: this.terminate is not a function
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-5-14:42:30-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-5-14:42:30-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-5-14:42:30-report.html
^C
[nodemon] 1.11.0
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node ./bin/nosmoke -s
udid: undefined
NoSmoke start at: http://30.28.177.76:5678
----> silent mode <-------
<-- GET /
{ stats:
{ suites: 0,
tests: 0,
passes: 3,
pending: 0,
failures: 0,
start: 2017-10-26T07:45:04.968Z,
passPercent: 50,
pendingPercent: 0,
other: 0,
hasOther: false,
skipped: 1,
hasSkipped: true,
duration: 14523,
end: 2017-10-26T07:45:04.968Z },
suites:
{ title: '',
ctx: {},
suites: [],
tests: [],
pending: [],
_beforeEach: [],
_beforeAll: [],
_afterEach: [],
_afterAll: [],
root: true,
_timeout: 2000,
_enableTimeouts: true,
_slow: 75,
_retries: -1,
delayed: false,
_events: { 'pre-require': [] },
_eventsCount: 1,
uuid: 'xxxxxxxxxxx',
fullFile: '',
file: '',
passes: [],
failures: [],
skipped: [],
totalTests: 0,
totalPasses: 0,
totalFailures: 0,
totalPending: 0,
totalSkipped: 0,
duration: 0,
_totalTime: 14523 },
current:
{ image: 'https://macacajs.github.io/macaca-logo/svg/monkey.svg',
list: [ [Object], [Object], [Object] ] } } { name: 'macaca-reporter',
fileName: 'index.html',
assetsInline: true,
dataAttr: 'data-output',
configAttr: 'config-output',
distDir: 'C:\auto\NoSmoke-master\NoSmoke-master',
socket: { server: 'http://30.28.177.76:56788' } }
reporter generated: C:\auto\NoSmoke-master\NoSmoke-master\reports\index.html
--> GET / 200
socket connected
(node:67976) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id:
2): FetchError: invalid json response body at http://localhost:3456/wd/hub/session reason:
Unexpected token I in JSON at position 0
====================================
helper.js:176:12 [master] pid:65136 Using local app form C:\Users\YOYO.macaca-temp\and
roid_app_bootstrap-debug.apk
uiautomator-client.js:30:12 [master] pid:65136 Error: Command failed: C:\gaoyuan\sdk/pl
atform-tools/adb -s a7daaba shell "pm clear "com.macaca.android.testing""
Failed
at ChildProcess.exithandler (child_process.js:198:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
responseHandler.js:56:12 [master] pid:65136 Send Error Respone to Client: Error: Comman
d failed: C:\gaoyuan\sdk/platform-tools/adb -s a7daaba push C:\Users\YOYO\AppData\Roaming
npm\node_modules\macaca-android\node_modules\uiautomatorwd\app\build\outputs\apk\app-debug
.apk /data/local/tmp/com.macaca.android.testing
responseHandler.js:62:14 [master] pid:65136 Error: Command failed: C:\gaoyuan\sdk/platf
orm-tools/adb -s a7daaba push C:\Users\YOYO\AppData\Roaming\npm\node_modules\macaca-androi
d\node_modules\uiautomatorwd\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.macac
a.android.testing
at ChildProcess.exithandler (child_process.js:198:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
Error: Command failed: C:\gaoyuan\sdk/platform-tools/adb -s a7daaba push C:\Users\YOYO\A
ppData\Roaming\npm\node_modules\macaca-android\node_modules\uiautomatorwd\app\build\output
s\apk\app-debug.apk /data/local/tmp/com.macaca.android.testing
at ChildProcess.exithandler (child_process.js:198:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
求大神指导。
purpose: Easier to get elements and click locations for crawling.
cmd@TR:~$ macaca doctor
macaca-doctor version: 2.0.4
Node.js checklist:
node env: /opt/nodejs/bin/node
node version: v6.10.3
Android checklist:
JAVA version is 1.8.0_151
JAVA_HOME is set to /usr/lib/jvm/java-8-oracle
ANDROID_HOME is set to /opt/android-sdk-linux
Platforms is set to /opt/android-sdk-linux/platforms/android-26
ADB tool is set to /opt/android-sdk-linux/platform-tools/adb
gradle is installed, version: 3.5
Installed driver list:
android: 2.0.45
chrome: 1.0.7
electron: 1.1.19
cmd@TR:~$ nosmoke -v
1.0.1
cmd@TR:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
H5Test.yml内容
desiredCapabilities:
platformName: 'Desktop'
browserName: 'Electron'
url: 'http://m.aicai.com/m/register.do?agentId=14759&vt=5'
crawlingConfig:
platform: 'pc-web'
targetElements:
CommonRegist:
searchValue : '常规注册'
loginAccount:
searchValue : 'jq_account'
actionValue : 'postsay123'
loginPassword:
searchValue : 'jq_comm_pass'
actionValue : '$%^&*213'
CellPhoneNumber:
searchValue : 'jq_mobile'
actionValue : '13751077575'
loginButton:
searchValue : 'common_registe'
alertConfirm:
searchValue : '该手机号已在本站注册过了,请更换手机号再试,多谢合作!'
clickTypes:
- 'a id'
- 'input id'
editTypes:
- 'input id'
macaca server Log
cmd@TR:~$ macaca server --verbose
request.js:24:12 [master] pid:24658 get remote update info failed.
index.js:18:12 [master] pid:24668 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '192.168.66.113',
host: 'TR',
loaded_time: '2018-01-04 15:15:16' }
middlewares.js:17:10 [master] pid:24668 base middlewares attached
router.js:133:10 [master] pid:24668 router set
webdriver sdk launched
responseHandler.js:11:12 [master] pid:24668 Recieve HTTP Request from Client[2018-01-04 15:15:43]: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformName":"Desktop","browserName":"Electron","url":"http://m.aicai.com/m/register.do?agentId=14759&vt=5"}}
session.js:47:10 [master] pid:24668 Creating session, sessionId: 2b92cb8f-9bd5-4e2b-bc5e-f65c2a8f6de2.
responseHandler.js:49:14 [master] pid:24668 Send HTTP Respone to Client[2018-01-04 15:15:46]: {"sessionId":"2b92cb8f-9bd5-4e2b-bc5e-f65c2a8f6de2","status":0,"value":"{"platformName":"Desktop","browserName":"Electron","url":"http://m.aicai.com/m/register.do?agentId=14759&vt=5\"}"}
responseHandler.js:11:12 [master] pid:24668 Recieve HTTP Request from Client[2018-01-04 15:15:46]: method: POST url: /wd/hub/session/2b92cb8f-9bd5-4e2b-bc5e-f65c2a8f6de2/url, jsonBody: {"url":"http://m.aicai.com/m/register.do?agentId=14759&vt=5"}
responseHandler.js:49:14 [master] pid:24668 Send HTTP Respone to Client[2018-01-04 15:15:47]: {"sessionId":"2b92cb8f-9bd5-4e2b-bc5e-f65c2a8f6de2","status":0,"value":null}
responseHandler.js:11:12 [master] pid:24668 Recieve HTTP Request from Client[2018-01-04 15:15:53]: method: GET url: /wd/hub/session/2b92cb8f-9bd5-4e2b-bc5e-f65c2a8f6de2/source, jsonBody: {}
responseHandler.js:49:14 [master] pid:24668 Send HTTP Respone to Client[2018-01-04 15:15:53]: {"sessionId":"2b92cb8f-9bd5-4e2b-bc5e-f65c2a8f6de2","status":0,"value":""<link href=\"https://rm.aicai.com/wap5/js/??plugins/lhgdialog/skins/chrome.css\\\" rel=\"stylesheet\" id=\"lhgdialoglink\">\n \t\t\n\n\n\n\t\t\n\t\t<meta charset=\"utf-8\">\n\t\t<meta http-equiv=\"Content-Type\" content=\"application/xhtml+xml; charset=utf-8\">\n\t\t<meta http-equiv=\"Cache-Control\" content=\"no-cache\">\n\t\t<meta http-equiv=\"Pragma\" content=..."}
responseHandler.js:11:12 [master] pid:24668 Recieve HTTP Request from Client[2018-01-04 15:15:53]: method: GET url: /wd/hub/session/2b92cb8f-9bd5-4e2b-bc5e-f65c2a8f6de2/url, jsonBody: {}
responseHandler.js:49:14 [master] pid:24668 Send HTTP Respone to Client[2018-01-04 15:15:53]: {"sessionId":"2b92cb8f-9bd5-4e2b-bc5e-f65c2a8f6de2","status":0,"value":""http://m.aicai.com/m/register.do?agentId=14759&vt=5\""}
nosmoke Log
cmd@TR:~/scripts/NoSmoke/web$ nosmoke -c H5Test.yml --verbose
server.js:15:12 [master] pid:24803 server start with config:
{ port: 5678,
verbose: true,
config: 'H5Test.yml',
ip: '192.168.66.113',
host: 'TR',
loaded_time: '2018-01-04 15:15:43' }
udid: undefined
(node:24803) DeprecationWarning: 'root' is deprecated, use 'global'
<-- GET /
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
--> GET / 200
initialize crawler
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
(node:24803) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'then' of undefined
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
然后就是如此一直报该句
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:15:42-report.html
现象是并没优先 找到 常规注册 然后点击 就一直循环。
这是一个问题 。
另这份也无法跑通,这份的现象就是访问到百度 接下来 并不执行后续配置的遍历内容。
webTest.yml内容
desiredCapabilities:
platformName: 'Desktop'
browserName: 'Electron'
url: 'https://www.baidu.com'
crawlingConfig:
platform: 'pc-web'
targetElements:
SearchConetent:
actionType: 2
searchValue : 'kw'
actionValue : '中文+Test+Nosmoke'
Search:
actionType: 1
searchValue : 'su'
clickTypes:
- 'a'
editTypes:
- 'input'
macaca server Log:
cmd@TR:~$ macaca server --verbose
index.js:18:12 [master] pid:25392 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '192.168.66.113',
host: 'TR',
loaded_time: '2018-01-04 15:19:49' }
middlewares.js:17:10 [master] pid:25392 base middlewares attached
router.js:133:10 [master] pid:25392 router set
webdriver sdk launched
responseHandler.js:11:12 [master] pid:25392 Recieve HTTP Request from Client[2018-01-04 15:20:10]: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"platformName":"Desktop","browserName":"Electron","url":"https://www.baidu.com"}}
session.js:47:10 [master] pid:25392 Creating session, sessionId: 15883f93-9eca-40fc-b07c-f0efbd95ecc1.
responseHandler.js:49:14 [master] pid:25392 Send HTTP Respone to Client[2018-01-04 15:20:13]: {"sessionId":"15883f93-9eca-40fc-b07c-f0efbd95ecc1","status":0,"value":"{"platformName":"Desktop","browserName":"Electron","url":"https://www.baidu.com\"}"}
responseHandler.js:11:12 [master] pid:25392 Recieve HTTP Request from Client[2018-01-04 15:20:13]: method: POST url: /wd/hub/session/15883f93-9eca-40fc-b07c-f0efbd95ecc1/url, jsonBody: {"url":"https://www.baidu.com"}
responseHandler.js:49:14 [master] pid:25392 Send HTTP Respone to Client[2018-01-04 15:20:13]: {"sessionId":"15883f93-9eca-40fc-b07c-f0efbd95ecc1","status":0,"value":null}
A Parser-blocking, cross site (i.e. different eTLD+1) script, http://s1.bdstatic.com/r/www/cache/static/global/js/all_async_search_f5b321b.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message.See https://www.chromestatus.com/feature/5718547946799104 for more details.
A Parser-blocking, cross site (i.e. different eTLD+1) script, http://s1.bdstatic.com/r/www/cache/static/global/js/all_async_search_f5b321b.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message.See https://www.chromestatus.com/feature/5718547946799104 for more details.
responseHandler.js:11:12 [master] pid:25392 Recieve HTTP Request from Client[2018-01-04 15:20:19]: method: GET url: /wd/hub/session/15883f93-9eca-40fc-b07c-f0efbd95ecc1/source, jsonBody: {}
responseHandler.js:49:14 [master] pid:25392 Send HTTP Respone to Client[2018-01-04 15:20:19]: {"sessionId":"15883f93-9eca-40fc-b07c-f0efbd95ecc1","status":0,"value":""\n \n <meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\">\n\t<meta content=\"always\" name=\"referrer\">\n <meta name=\"theme-color\" content=\"#2932e1\">\n <link rel=\"shortcut icon\" href=\"/favicon.ico\" type=\"image/x-icon\">\n <link rel=\"search\" type=\"application/opensearchdescr..."}
responseHandler.js:11:12 [master] pid:25392 Recieve HTTP Request from Client[2018-01-04 15:20:19]: method: GET url: /wd/hub/session/15883f93-9eca-40fc-b07c-f0efbd95ecc1/url, jsonBody: {}
responseHandler.js:49:14 [master] pid:25392 Send HTTP Respone to Client[2018-01-04 15:20:19]: {"sessionId":"15883f93-9eca-40fc-b07c-f0efbd95ecc1","status":0,"value":""http://www.baidu.com/\""}
responseHandler.js:11:12 [master] pid:25392 Recieve HTTP Request from Client[2018-01-04 15:20:19]: method: GET url: /wd/hub/session/15883f93-9eca-40fc-b07c-f0efbd95ecc1/source, jsonBody: {}
responseHandler.js:49:14 [master] pid:25392 Send HTTP Respone to Client[2018-01-04 15:20:19]: {"sessionId":"15883f93-9eca-40fc-b07c-f0efbd95ecc1","status":0,"value":""\n \n <meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\">\n\t<meta content=\"always\" name=\"referrer\">\n <meta name=\"theme-color\" content=\"#2932e1\">\n <link rel=\"shortcut icon\" href=\"/favicon.ico\" type=\"image/x-icon\">\n <link rel=\"search\" type=\"application/opensearchdescr..."}
responseHandler.js:11:12 [master] pid:25392 Recieve HTTP Request from Client[2018-01-04 15:20:19]: method: GET url: /wd/hub/session/15883f93-9eca-40fc-b07c-f0efbd95ecc1/url, jsonBody: {}
responseHandler.js:49:14 [master] pid:25392 Send HTTP Respone to Client[2018-01-04 15:20:19]: {"sessionId":"15883f93-9eca-40fc-b07c-f0efbd95ecc1","status":0,"value":""http://www.baidu.com/\""}
responseHandler.js:11:12 [master] pid:25392 Recieve HTTP Request from Client[2018-01-04 15:20:25]: method: GET url: /wd/hub/session/15883f93-9eca-40fc-b07c-f0efbd95ecc1/source, jsonBody: {}
responseHandler.js:49:14 [master] pid:25392 Send HTTP Respone to Client[2018-01-04 15:20:25]: {"sessionId":"15883f93-9eca-40fc-b07c-f0efbd95ecc1","status":0,"value":""\n \n <meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\">\n\t<meta content=\"always\" name=\"referrer\">\n <meta name=\"theme-color\" content=\"#2932e1\">\n <link rel=\"shortcut icon\" href=\"/favicon.ico\" type=\"image/x-icon\">\n <link rel=\"search\" type=\"application/opensearchdescr..."}
responseHandler.js:11:12 [master] pid:25392 Recieve HTTP Request from Client[2018-01-04 15:20:25]: method: GET url: /wd/hub/session/15883f93-9eca-40fc-b07c-f0efbd95ecc1/url, jsonBody: {}
responseHandler.js:49:14 [master] pid:25392 Send HTTP Respone to Client[2018-01-04 15:20:25]: {"sessionId":"15883f93-9eca-40fc-b07c-f0efbd95ecc1","status":0,"value":""http://www.baidu.com/\""}
nosmoke Log:
cmd@TR:~/scripts/NoSmoke/web$ nosmoke -c webTest.yml --verbose
server.js:15:12 [master] pid:25447 server start with config:
{ port: 5678,
verbose: true,
config: 'webTest.yml',
ip: '192.168.66.113',
host: 'TR',
loaded_time: '2018-01-04 15:20:09' }
udid: undefined
(node:25447) DeprecationWarning: 'root' is deprecated, use 'global'
<-- GET /
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:20:9-report.html
--> GET / 200
initialize crawler
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:20:9-report.html
{ raw: 'a href="/" id="result_logo" onmousedown="return c({'fm':'tab','tab':'logo'})"',
data: 'a href="/" id="result_logo" onmousedown="return c({'fm':'tab','tab':'logo'})"',
type: 'a',
name: 'a',
attribs:
{ href: '/',
id: 'result_logo',
onmousedown: 'return c({'fm':'tab','tab':'logo'})' } }
{ raw: 'input type="hidden" name="ie" value="utf-8"',
data: 'input type="hidden" name="ie" value="utf-8"',
type: 'input',
name: 'input',
attribs: { type: 'hidden', name: 'ie', value: 'utf-8' },
input: 'random+123' }
{ raw: 'input type="hidden" name="f" value="8"',
data: 'input type="hidden" name="f" value="8"',
type: 'input',
name: 'input',
attribs: { type: 'hidden', name: 'f', value: '8' },
input: 'random+123' }
reporter generated: /home/cmd/scripts/NoSmoke/web/reports/2018-0-4-15:20:9-report.html
^C
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.