节点_取XML
- 函数原型
const char* __stdcall EB_节点_取XML (const char* Serial)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取
- 返回值
""
失败
示例
printf ("XML:%s", EB_节点_取XML ("emulator-5554"));
节点_取Json
- 函数原型
const char* __stdcall EB_节点_取Json (const char* Serial)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取
- 返回值
""
失败
示例
printf ("Json:%s", EB_节点_取Json ("emulator-5554"));
节点_刷新
- 函数原型
void __stdcall EB_节点_刷新 (const char* Serial)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取
- 返回值
示例
EB_节点_刷新("emulator-5554");
节点_查找
- 函数原型
int __stdcall EB_节点_查找 (const char* Serial,const char* Text,const char* Res,const char* Class,const char* Package,const char* Desc,int Time)
参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取Text
[标题]Res
[资源ID]Class
[类型]Package
[包名]Desc
[描述]Time
[等待时间] -- 空 = 不等待 立即返回 单位 毫秒
返回值
hWnd
-1
未找到或失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554", "雷电游戏中心", "", "android.widget.TextView", "com.android.launcher3", "雷电游戏中心", 1000)
if( Nodeh != -1){
printf ("节点句柄:%d", Nodeh);
return true;
}else {
printf ("未找到");
return false;
};
提示
支持正则匹配 如: 部分匹配 = grep('.关键字.') 开头匹配 = grep('^关键字.*$') 结尾匹配 = grep('^.*关键字$')
节点_查找子节点
- 函数原型
int __stdcall EB_节点_查找子节点 (const char* Serial, int hWnd ,const char* Text,const char* Res,const char* Class,const char* Package,const char* Desc)
参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[父节点句柄]Text
[标题]Res
[资源ID]Class
[类型]Package
[包名]Desc
[描述]
返回值
hWnd
-1
未找到或失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "", "android.view.ViewGroup", "com.android.launcher3", "", 1000)
int Nodehh = EB_节点_查找子节点 ("emulator-5554", Nodeh, "雷电游戏中心", "", "android.widget.TextView", "com.android.launcher3", "雷电游戏中心")
if( Nodehh != -1){
printf ("子节点句柄:%d", Nodehh);
return true;
}else {
printf ("未找到");
return false;
};
提示
支持正则匹配 如: 部分匹配 = grep('.关键字.') 开头匹配 = grep('^关键字.*$') 结尾匹配 = grep('^.*关键字$')
节点_查找EX
- 函数原型
const char* __stdcall EB_节点_查找EX (const char* Serial, const char* Index,const char* Text,const char* Res,const char* Class,const char* Package,const char* Desc,const char* Checkable,const char* Checked,const char* Clickable,const char* Enabled,const char* Focusable,const char* Focused,const char* Scrollable,const char* Longclickable,const char* Selected,const char* Bounds,int Num,int Time)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取Text
[标题]Res
[资源ID]Class
[类型]Package
[包名]Checkable
[是否允许勾选]Checked
[当前勾选状态]Clickable
[是否允许点击]Enabled
[是否允许激活]Focusable
[是否允许置焦点]Focused
[当前焦点状态]Scrollable
[是否允许滚动]Longclickable
[是否允许长按]Selected
[是否可以选中]Bounds
[范围]Num
[节点序号] --指定第几个控件 默认为 0 (查找EX:是查找所有满足条件的控件集合,如需要可指定返回第几个控件) 从1开始Time
[等待时间] -- 空 = 不等待 立即返回 单位 毫秒
- 返回值
nodeHandles
""
未找到或失败
示例
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cstring> // for strtok (C-style string splitting)
// 分割
std::vector<std::string> SplitCString(const char* str, char delimiter) {
std::vector<std::string> tokens;
if (!str) return tokens;
char* copy = strdup(str);
char* token = strtok(copy, &delimiter);
while (token) {
tokens.push_back(token);
token = strtok(nullptr, &delimiter);
}
free(copy);
return tokens;
}
// 1. 查找节点
EB_节点_刷新();
const char* 节点句柄 = EB_节点_查找EX (, , , "android.widget.TextView", "com.huawei.android.launcher", , , , , , , , , , , , 1, 1000);
// 2. 分割节点句柄字符串
std::vector<std::string> splitHandles = SplitCString(节点句柄, '\n');
int nodeCount = splitHandles.size();
// 3. 输出结果
if (nodeCount > 0) {
std::cout << "找到:" << nodeCount << "个节点" << std::endl;
} else {
std::cout << "未找到" << std::endl;
}
// 遍历所有节点
for (int i = 0; i < nodeCount; ++i) {
int handle = std::stoi(splitHandles[i]);
const char* nodeText = EB_节点_取节点属性 (handle, 2)
std::cout << "节点句柄: " << splitHandles[i]
<< " 节点标题: " << (nodeText ? nodeText : "(NULL)") << std::endl;
}
提示
支持正则匹配 如: 部分匹配 = grep('.关键字.') 开头匹配 = grep('^关键字.*$') 结尾匹配 = grep('^.*关键字$')
节点_查找子节点EX
- 函数原型
const char* __stdcall EB_节点_查找子节点EX (const char* Serial, int hWnd ,const char* Index,const char* Text,const char* Res,const char* Class,const char* Package,const char* Desc,const char* Checkable,const char* Checked,const char* Clickable,const char* Enabled,const char* Focusable,const char* Focused,const char* Scrollable,const char* Longclickable,const char* Selected,const char* Bounds,int Num)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[父节点句柄]Text
[标题]Res
[资源ID]Class
[类型]Package
[包名]Checkable
[是否允许勾选]Checked
[当前勾选状态]Clickable
[是否允许点击]Enabled
[是否允许激活]Focusable
[是否允许置焦点]Focused
[当前焦点状态]Scrollable
[是否允许滚动]Longclickable
[是否允许长按]Selected
[是否可以选中]Bounds
[范围]Num
[节点序号] --指定第几个控件 默认为 0 (查找EX:是查找所有满足条件的控件集合,如需要可指定返回第几个控件) 从1开始
- 返回值
nodeHandles
""
未找到或失败
示例
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cstring> // for strtok (C-style string splitting)
// 分割
std::vector<std::string> SplitCString(const char* str, char delimiter) {
std::vector<std::string> tokens;
if (!str) return tokens;
char* copy = strdup(str);
char* token = strtok(copy, &delimiter);
while (token) {
tokens.push_back(token);
token = strtok(nullptr, &delimiter);
}
free(copy);
return tokens;
}
// 1. 查找父节点
EB_节点_刷新();
int 父节点句柄 = EB_节点_查找(, "com.huawei.android.launcher:id/folder_page_one", "android.view.ViewGroup", "com.huawei.android.launcher", , 1000);
const char* 子节点句柄 = EB_节点_查找子节点EX (父节点句柄, , , , "android.widget.TextView", "com.huawei.android.launcher", , , , , , , , , , , , 0);
// 2. 分割节点句柄字符串
std::vector<std::string> splitHandles = SplitCString(子节点句柄, '\n');
int nodeCount = splitHandles.size();
// 3. 输出结果
if (nodeCount > 0) {
std::cout << "找到:" << nodeCount << "个子节点" << std::endl;
} else {
std::cout << "未找到" << std::endl;
}
// 遍历所有节点
for (int i = 0; i < nodeCount; ++i) {
int handle = std::stoi(splitHandles[i]);
const char* nodeText = EB_节点_取节点属性 (handle, 2)
std::cout << "节点句柄: " << splitHandles[i]
<< " 节点标题: " << (nodeText ? nodeText : "(NULL)") << std::endl;
}
提示
支持正则匹配 如: 部分匹配 = grep('.关键字.') 开头匹配 = grep('^关键字.*$') 结尾匹配 = grep('^.*关键字$')
节点_点击
- 函数原型
int __stdcall EB_节点_点击 (const char* Serial, int hWnd)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]
- 返回值
0
成功-1
失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","雷电游戏中心", "", "android.widget.TextView", "com.android.launcher3", "雷电游戏中心", 1000)
if( !EB_节点_点击 ("emulator-5554",Nodeh)){
printf ("点击成功");
return true;
}else {
printf ("点击失败");
return false;
};
节点_长按
- 函数原型
int __stdcall EB_节点_长按 (const char* Serial, int hWnd)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]
- 返回值
0
成功-1
失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","雷电游戏中心", "", "android.widget.TextView", "com.android.launcher3", "雷电游戏中心", 1000)
if( !EB_节点_长按 ("emulator-5554",Nodeh)){
printf ("长按成功");
return true;
}else {
printf ("长按失败");
return false;
};
节点_拖动
- 函数原型
int __stdcall EB_节点_拖动 (const char* Serial, int hWnd,int x,int y,int Speed)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]x
[坐标x]--终点xy
[坐标y]--终点YSpeed
[速度]-- 默认100 数字越大越快
- 返回值
0
成功-1
失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "", "android.widget.FrameLayout", "com.android.launcher3", "文件夹:系统应用", 1000)
if( !EB_节点_拖动 ("emulator-5554",Nodeh, 306, 626, 100)){
printf ("拖动成功");
return true;
}else {
printf ("拖动失败");
return false;
};
节点_滚动
- 函数原型
void __stdcall EB_节点_滚动 (const char* Serial, int hWnd,int Direction,int Span,int Speed)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]Direction
[方向]--0向上 1向下 2向左 3向右Span
[跨度]--1-100 默认10Speed
[速度]-- 1-100 默认10
- 返回值
- 无
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "", "android.support.v7.widget.RecyclerView", "com.android.settings", "", 1000)
EB_节点_滚动 ("emulator-5554",Nodeh, 1, 30, 30)
节点_滑动
- 函数原型
void __stdcall EB_节点_滑动 (const char* Serial, int hWnd,int Direction,int Span,int Speed)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]Direction
[方向]--0向上 1向下 2向左 3向右Span
[跨度]--1-100 默认10Speed
[速度]-- 1-100 默认10
- 返回值
- 无
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "", "android.support.v7.widget.RecyclerView", "com.android.settings", "", 1000)
EB_节点_滑动 ("emulator-5554",Nodeh, 1, 30, 30)
节点_捏合手势
- 函数原型
void __stdcall EB_节点_捏合手势 (const char* Serial, int hWnd,int Span,int Speed)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]Span
[跨度]--1-100 默认10Speed
[速度]-- 1-100 默认10
- 返回值
- 无
示例
//图库图片
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "com.android.gallery3d:id/gl_root_view", "android.view.View", "com.android.gallery3d", "", 1000)
EB_节点_捏合手势 ("emulator-5554",Nodeh, 60, 30)
节点_捏开手势
- 函数原型
void __stdcall EB_节点_捏开手势 (const char* Serial, int hWnd,int Span,int Speed)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]Span
[跨度]--1-100 默认10Speed
[速度]-- 1-100 默认10
- 返回值
- 无
示例
//图库图片
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "com.android.gallery3d:id/gl_root_view", "android.view.View", "com.android.gallery3d", "", 1000)
EB_节点_捏开手势 ("emulator-5554",Nodeh, 60, 30)
节点_是否存在
- 函数原型
int __stdcall EB_节点_是否存在 (const char* Serial,const char* Text,const char* Res,const char* Class,const char* Package,const char* Desc)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取Text
[标题]Res
[资源ID]Class
[类型]Package
[包名]Desc
[描述]
- 返回值
0
成功-1
未找到或失败
示例
if( !EB_节点_是否存在 ("emulator-5554", "雷电游戏中心", "", "android.widget.TextView", "com.android.launcher3", "雷电游戏中心")){
printf ("存在");
return true;
}else {
printf ("不存在");
return false;
};
提示
支持正则匹配 如: 部分匹配 = grep('.关键字.') 开头匹配 = grep('^关键字.*$') 结尾匹配 = grep('^.*关键字$')
节点_取父节点
- 函数原型
int __stdcall EB_节点_取父节点 (const char* Serial, int hWnd)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[子节点句柄]
- 返回值
节点句柄
-1
未找到或失败
示例
EB_节点_刷新();
int Nodehh = EB_节点_查找 ("emulator-5554","雷电游戏中心", "", "android.widget.TextView", "com.android.launcher3", "雷电游戏中心", 1000)
int Nodeh = EB_节点_取父节点 ("emulator-5554",Nodehh)
if( Nodeh != -1){
printf ("父节点句柄:%d", Nodeh);
return true;
}else {
printf ("未找到");
return false;
};
节点_取子节点
- 函数原型
int __stdcall EB_节点_取子节点 (const char* Serial, int hWnd, int Num)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[父节点句柄]Num
[子节点索引]
- 返回值
hWnd
成功-1
未找到或失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "", "android.view.ViewGroup", "com.android.launcher3", "", 1000)
int Nodehh = EB_节点_取子节点 ("emulator-5554",Nodeh, 2)
if( Nodehh != -1){
printf ("子节点句柄:%d", Nodehh);
return true;
}else {
printf ("未找到");
return false;
};
节点_点击等待
- 函数原型
int __stdcall EB_节点_点击等待 (const char* Serial, int hWnd, int Time)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]Time
[等待时间]
- 返回值
0
成功-1
未找到或失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","雷电游戏中心", "", "android.widget.TextView", "com.android.launcher3", "雷电游戏中心", 1000)
if( !EB_节点_点击等待 ("emulator-5554",Nodeh, 2000)){
printf ("点击成功");
return true;
}else {
printf ("失败或超时");
return false;
};
节点_输入文字
- 函数原型
void __stdcall EB_节点_输入文字 (const char* Serial, int hWnd, const char* Str)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]Str
[要输入的文字]
- 返回值
- 无
示例
//设置页面搜索框
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "", "android.widget.EditText", "com.android.settings.intelligence", "", 1000)
EB_节点_输入文字 ("emulator-5554", Nodeh, "EtpBot输入文字");
节点_清空文字
- 函数原型
void __stdcall EB_节点_清空文字 (const char* Serial, int hWnd)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]
- 返回值
- 无
示例
//设置页面搜索框
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "", "android.widget.EditText", "com.android.settings.intelligence", "", 1000)
EB_节点_清空文字 ("emulator-5554", Nodeh);
节点_设置模式
- 函数原型
void __stdcall EB_节点_设置模式 (const char* Serial, int Mode)
参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取Mode
[模式]-- 默认 普通模式0
普通模式1
加强模式2
超强模式
返回值
- 无
示例
EB_节点_设置模式 (1)
节点_取兄弟节点
- 函数原型
int __stdcall EB_节点_取兄弟节点 (const char* Serial, int hWnd, int Num)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]Num
[兄弟节点索引]
- 返回值
hWnd
成功-1
未找到或失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","雷电游戏中心", "", "android.widget.TextView", "com.android.launcher3", "雷电游戏中心", 1000);
int Nodeh2 = EB_节点_取兄弟节点 ("emulator-5554", Nodeh, 2);
if( Nodeh2 != -1){
printf ("兄弟节点句柄:%d", Nodehh);
return true;
}else {
printf ("未找到");
return false;
};
节点_取节点属性
- 函数原型
const char* __stdcall EB_节点_取节点属性 (const char* Serial, int hWnd, int Nat)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]Nat
[节点属性]-- 0 取所有属性
- 返回值
""
失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","雷电游戏中心", "", "android.widget.TextView", "com.android.launcher3", "雷电游戏中心", 1000)
printf ("节点属性:%s", EB_节点_取节点属性 ("emulator-5554", Nodeh, 0) );
节点属性名 | 属性值 | 说明 |
---|---|---|
Index | 1 | 索引 |
Text | 2 | 标题 |
Resource-id | 4 | 资源ID |
Class | 8 | 类名 |
Package | 16 | 包名 |
Content-desc | 32 | 描述 |
Checkable | 64 | 是否允许勾选 |
Checked | 128 | 当前勾选状态 |
Clickable | 256 | 是否允许点击 |
Enabled | 512 | 是否允许激活 |
Focusable | 1024 | 是否允许置焦点 |
Focused | 2048 | 当前焦点状态 |
Scrollable | 4096 | 是否允许滚动 |
Long-clickable | 8192 | 是否允许长按 |
Selected | 16384 | 是否可以选中 |
Bounds | 32768 | 范围 |
Center | 65536 | 中心点坐标 |
节点_取子节点数量
- 函数原型
int __stdcall EB_节点_取子节点数量 (const char* Serial, int hWnd)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[父节点句柄]
- 返回值
-1
失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "", "android.support.v7.widget.RecyclerView", "com.android.settings", "", 1000)
printf ("子节点数量:%d", EB_节点_取子节点数量 ("emulator-5554", Nodeh) );
节点_取兄弟节点数量
- 函数原型
int __stdcall EB_节点_取兄弟节点数量 (const char* Serial, int hWnd)
- 参数定义
Serial
[设备标识] --手机设备标识符 ADB命令获取hWnd
[节点句柄]
- 返回值
-1
失败
示例
EB_节点_刷新();
int Nodeh = EB_节点_查找 ("emulator-5554","", "", "android.widget.LinearLayout", "com.android.settings", "", 1000)
printf ("兄弟节点数量:%d", EB_节点_取兄弟节点数量 ("emulator-5554", Nodeh) );