Gathering detailed insights and metrics for adbkit-monkey
Gathering detailed insights and metrics for adbkit-monkey
Gathering detailed insights and metrics for adbkit-monkey
Gathering detailed insights and metrics for adbkit-monkey
A Node.js interface to the Android monkey tool.
npm install adbkit-monkey
Typescript
Module System
Min. Node Version
NPM Version
99.4
Supply Chain
99
Quality
77.4
Maintenance
100
Vulnerability
100
License
CoffeeScript (97.19%)
Shell (2.81%)
Total Downloads
10,563,136
Last Day
514
Last Week
12,557
Last Month
59,138
Last Year
860,091
NOASSERTION License
47 Stars
95 Commits
36 Forks
16 Watchers
2 Branches
6 Contributors
Updated on Jan 22, 2025
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
adbkit-monkey@1.0.1
Size
7.31 kB
NPM Version
1.3.14
Published on
Nov 26, 2013
Cumulative downloads
Total Downloads
Last Day
-68.7%
514
Compared to previous day
Last Week
-4.7%
12,557
Compared to previous week
Last Month
25.6%
59,138
Compared to previous month
Last Year
-36.4%
860,091
Compared to previous year
adbkit-monkey provides a Node.js interface for working with the Android monkey
tool. Albeit undocumented, they monkey program can be started in TCP mode with the --port
argument. In this mode, it accepts a range of commands that can be used to interact with the UI in a non-random manner. This mode is also used internally by the monkeyrunner
tool, although the documentation claims no relation to the monkey tool.
Install via NPM:
1npm install --save adbkit-monkey
Note that while adbkit-monkey is written in CoffeeScript, it is compiled to JavaScript before publishing to NPM, which means that you are not required to use CoffeeScript.
The following examples assume that monkey is already running (via adb shell monkey --port 1080
) and a port forwarding (adb forward tcp:1080 tcp:1080
) has been set up.
1var assert = require('assert'); 2var monkey = require('adbkit-monkey'); 3 4var client = monkey.connect({ port: 1080 }); 5 6client.press(3 /* KEYCODE_HOME */, function(err) { 7 assert.ifError(err); 8 console.log('Pressed home button'); 9 client.end(); 10});
1var assert = require('assert'); 2var monkey = require('adbkit-monkey'); 3 4var client = monkey.connect({ port: 1080 }); 5 6client.multi() 7 .touchDown(100, 0) 8 .sleep(5) 9 .touchMove(100, 20) 10 .sleep(5) 11 .touchMove(100, 40) 12 .sleep(5) 13 .touchMove(100, 60) 14 .sleep(5) 15 .touchMove(100, 80) 16 .sleep(5) 17 .touchMove(100, 100) 18 .sleep(5) 19 .touchUp(100, 100) 20 .sleep(5) 21 .execute(function(err) { 22 assert.ifError(err); 23 console.log('Dragged out the notification bar'); 24 client.end(); 25 });
1var assert = require('assert'); 2var monkey = require('adbkit-monkey'); 3 4var client = monkey.connect({ port: 1080 }); 5 6client.getDisplayWidth(function(err, width) { 7 assert.ifError(err); 8 client.getDisplayHeight(function(err, height) { 9 assert.ifError(err); 10 console.log('Display size is %dx%d', width, height); 11 client.end(); 12 }); 13});
Note that you should manually focus a text field first.
1var assert = require('assert'); 2var monkey = require('adbkit-monkey'); 3 4var client = monkey.connect({ port: 1080 }); 5 6client.type('hello monkey!', function(err) { 7 assert.ifError(err); 8 console.log('Said hello to monkey'); 9 client.end(); 10});
Uses Net.connect() to open a new TCP connection to monkey. Useful when combined with adb forward
.
Net.connect()
accepts.Client
instance.Attaches a monkey client to an existing monkey protocol stream.
Stream
.Client
instance.Implements Api
. See below for details.
The following events are available:
Error
.Ends the underlying stream/connection.
Client
instance.Returns a new API wrapper that buffers commands for simultaneous delivery instead of sending them individually. When used with api.sleep()
, allows simple gestures to be executed.
Multi
instance. See Multi
below.Sends a raw protocol command to monkey.
String
, a single command is sent. When Array
, a series of commands is sent at once.null
when successful, Error
otherwise.Client
instance.The monkey API implemented by Client
and Multi
.
Closes the current monkey session and allows a new session to connect.
null
when successful, Error
otherwise.Api
implementation instance.Simulates closing the keyboard.
null
when successful, Error
otherwise.Api
implementation instance.Simulates opening the keyboard.
null
when successful, Error
otherwise.Api
implementation instance.Gets the value of a variable. Use api.list()
to retrieve a list of supported variables.
null
when successful, Error
otherwise.Api
implementation instance.Alias for api.get('am.current.action', callback)
.
Alias for api.get('am.current.categories', callback)
.
Alias for api.get('am.current.comp.class', callback)
.
Alias for api.get('am.current.comp.package', callback)
.
Alias for api.get('am.current.data', callback)
.
Alias for api.get('am.current.package', callback)
.
Alias for api.get('build.board', callback)
.
Alias for api.get('build.brand', callback)
.
Alias for api.get('build.cpu_abi', callback)
.
Alias for api.get('build.device', callback)
.
Alias for api.get('build.display', callback)
.
Alias for api.get('build.fingerprint', callback)
.
Alias for api.get('build.host', callback)
.
Alias for api.get('build.id', callback)
.
Alias for api.get('build.manufacturer', callback)
.
Alias for api.get('build.model', callback)
.
Alias for api.get('build.product', callback)
.
Alias for api.get('build.tags', callback)
.
Alias for api.get('build.type', callback)
.
Alias for api.get('build.user', callback)
.
Alias for api.get('build.version.codename', callback)
.
Alias for api.get('build.version.incremental', callback)
.
Alias for api.get('build.version.release', callback)
.
Alias for api.get('build.version.sdk', callback)
.
Alias for api.get('clock.millis', callback)
.
Alias for api.get('clock.realtime', callback)
.
Alias for api.get('clock.uptime', callback)
.
Alias for api.get('display.density', callback)
.
Alias for api.get('display.height', callback)
. Note that the height may exclude any virtual home button row.
Alias for api.get('display.width', callback)
.
Sends a key down event. Should be coupled with api.keyUp()
. Note that api.press()
performs the two events automatically.
'home'
to KEYCODE_HOME
). This will not work for number keys however. The most portable method is to simply use numeric key codes.null
when successful, Error
otherwise.Api
implementation instance.Sends a key up event. Should be coupled with api.keyDown()
. Note that api.press()
performs the two events automatically.
api.keyDown()
.null
when successful, Error
otherwise.Api
implementation instance.Lists supported variables.
null
when successful, Error
otherwise.api.get()
.Api
implementation instance.Sends a key press event.
api.keyDown()
.null
when successful, Error
otherwise.Api
implementation instance.Closes the current monkey session and quits monkey.
null
when successful, Error
otherwise.Api
implementation instance.Sleeps for the given duration. Can be useful for simulating gestures.
null
when successful, Error
otherwise.Api
implementation instance.Taps the given coordinates.
null
when successful, Error
otherwise.Api
implementation instance.Sends a touch down event on the given coordinates.
null
when successful, Error
otherwise.Api
implementation instance.Sends a touch move event on the given coordinates.
null
when successful, Error
otherwise.Api
implementation instance.Sends a touch up event on the given coordinates.
null
when successful, Error
otherwise.Api
implementation instance.Sends a trackball event on the given coordinates.
null
when successful, Error
otherwise.Api
implementation instance.Types the given text.
String
. Note that only characters for which key codes exist can be entered. Also note that any IME in use may or may not transform the text.null
when successful, Error
otherwise.Api
implementation instance.Wakes the device from sleep and allows user input.
null
when successful, Error
otherwise.Api
implementation instance.Buffers Api
commands and delivers them simultaneously for greater control over timing.
Implements all Api
methods, but without the last callback
parameter.
Sends all buffered commands.
null
when successful, Error
otherwise.Api
responses.See CONTRIBUTING.md.
See LICENSE.
Copyright © CyberAgent, Inc. All Rights Reserved.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More