@nbakka/mcp-appium 4.0.4 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/android.js +26 -8
  2. package/package.json +1 -1
package/lib/android.js CHANGED
@@ -175,15 +175,33 @@ class AndroidRobot {
175
175
  collectSimplifiedElements(node) {
176
176
  const elements = [];
177
177
 
178
- // Recursively traverse children first
179
- if (node.node) {
180
- if (Array.isArray(node.node)) {
181
- for (const childNode of node.node) {
182
- elements.push(...this.collectSimplifiedElements(childNode));
183
- }
178
+ // Recursively traverse all child nodes
179
+ // Check all properties to find child elements (they can have any tag name)
180
+ for (const key of Object.keys(node)) {
181
+ // Skip attribute properties (they don't contain child elements)
182
+ if (key === 'text' || key === 'content-desc' || key === 'resource-id' ||
183
+ key === 'class' || key === 'bounds' || key === 'package' ||
184
+ key === 'checkable' || key === 'checked' || key === 'clickable' ||
185
+ key === 'enabled' || key === 'focusable' || key === 'focused' ||
186
+ key === 'long-clickable' || key === 'password' || key === 'scrollable' ||
187
+ key === 'selected' || key === 'index' || key === 'displayed' ||
188
+ key.startsWith('a11y-') || key === 'drawing-order' || key === 'showing-hint' ||
189
+ key === 'text-entry-key' || key === 'dismissable' || key === 'heading' ||
190
+ key === 'live-region' || key === 'context-clickable' || key === 'content-invalid' ||
191
+ key === 'window-id' || key === 'rotation' || key === 'width' || key === 'height' ||
192
+ key === 'screen-reader-focusable' || key === 'hint' || key === 'pane-title') {
193
+ continue;
184
194
  }
185
- else {
186
- elements.push(...this.collectSimplifiedElements(node.node));
195
+
196
+ const value = node[key];
197
+ if (value && typeof value === 'object') {
198
+ if (Array.isArray(value)) {
199
+ for (const childNode of value) {
200
+ elements.push(...this.collectSimplifiedElements(childNode));
201
+ }
202
+ } else {
203
+ elements.push(...this.collectSimplifiedElements(value));
204
+ }
187
205
  }
188
206
  }
189
207
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbakka/mcp-appium",
3
- "version": "4.0.4",
3
+ "version": "4.0.6",
4
4
  "description": "Appium MCP",
5
5
  "engines": {
6
6
  "node": ">=18"