Uiautomator
NodeJS wrapper for UiAutomator
Install / Use
/learn @fmca/UiautomatorREADME
uiautomator [Alpha]
NodeJS wrapper for UiAutomator
Installation
npm install uiautomator-wrapper
Usage
CommonJS
var Device = require('uiautomator-wrapper');
var device = new Device();
device.connect()
.then(() => device.home())
.then(() => device.click({ description: 'Apps' }))
.then(() => device.back())
.then(() => console.log('Finished'))
.catch((err) => console.error(err))
ES6
import Device from 'uiautomator-wrapper';
const test = async () => {
const device = new Device();
await device.connect();
await device.home();
await device.click({ description: 'Apps' });
await device.back();
};
test()
.then(() => console.log('Finished'))
.catch(err => console.error(err));
Device setup
var options = {
serial: "emulator5554"
}
var device = new Device(options);
Default options:
{
hostname: 'localhost',
delay: 500, //delay between commands
port: 9008,
devicePort: 9008,
connectionMaxTries: 5,
connectionTriesDelay: 1000,
serial: undefined //Not necessary if there is only one device available
}
API
-
Device info
device.info() -
Key events
//Press home device.home() //Press back device.back()- All key functions:
home,volumeUp,volumeDown,volumeMute,back,right,left,up,down,menu,search,center,enter,delete,recent,camera,power
- All key functions:
-
Selectors
device.click({description: 'Apps'});- Supported Selectors:
text,textContains,textMatches,textStartsWith,className,classNameMatches,description,descriptionContains,descriptionMatches,descriptionStartsWith,checkable,checked,clickable,longClickable,scrollable,enabled,focusable,focused,selected,packageName,packageNameMatches,resourceId,resourceIdMatches,index,instance
- Supported Selectors:
-
Input text
device.setText({description: 'Message'}, 'Hello World')
Acknowledgement
This package is inspired by xiaocong/uiautomator python library, even using its android-uiautomator-server.
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
