appium-uiautomator2-driver 6.4.0 → 6.5.0

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.
@@ -96,12 +96,35 @@ export async function mobileGetDeviceInfo() {
96
96
  */
97
97
  export async function mobileResetAccessibilityCache() {
98
98
  await this.uiautomator2.jwproxy.command(
99
- '/reset_ax_cache',
99
+ '/appium/reset_ax_cache',
100
100
  'POST',
101
101
  {}
102
102
  );
103
103
  }
104
104
 
105
+ /**
106
+ * Gets a list of windows on all displays.
107
+ * For Android API 30+ (R), uses getWindowsOnAllDisplays().
108
+ * For older APIs, uses getWindows().
109
+ * @this {AndroidUiautomator2Driver}
110
+ * @param {import('./types').WindowFilters} [filters] Optional filters to apply to the window list.
111
+ * All filters are applied with AND logic (all must match).
112
+ * @param {boolean} [skipScreenshots] Whether to skip taking screenshots for each window. Defaults to false.
113
+ * @returns {Promise<Array<import('./types').WindowInfo>>} Array of window information objects
114
+ */
115
+ export async function mobileListWindows(filters, skipScreenshots) {
116
+ return /** @type {Array<import('./types').WindowInfo>} */ (
117
+ await this.uiautomator2.jwproxy.command(
118
+ '/appium/list_windows',
119
+ 'POST',
120
+ {
121
+ filters,
122
+ skipScreenshots,
123
+ }
124
+ )
125
+ );
126
+ }
127
+
105
128
  /**
106
129
  * @template [T=any]
107
130
  * @typedef {import('@appium/types').StringRecord<T>} StringRecord
@@ -80,3 +80,55 @@ export interface ActionResult {
80
80
  repeats: number;
81
81
  stepResults: StringRecord[][];
82
82
  }
83
+
84
+ export interface WindowFilters {
85
+ /**
86
+ * Package name pattern with glob support (e.g., 'com.example.*')
87
+ */
88
+ packageName?: string;
89
+ /**
90
+ * Window identifier
91
+ */
92
+ windowId?: number;
93
+ /**
94
+ * Display identifier
95
+ */
96
+ displayId?: number;
97
+ /**
98
+ * Physical display identifier
99
+ */
100
+ physicalDisplayId?: number;
101
+ }
102
+
103
+ export interface WindowInfo {
104
+ /**
105
+ * Window identifier (may be null)
106
+ */
107
+ windowId: number | null;
108
+ /**
109
+ * Display identifier where the window is located (may be null)
110
+ */
111
+ displayId: number | null;
112
+ /**
113
+ * Physical display identifier (may be null)
114
+ */
115
+ physicalDisplayId: number | null;
116
+ /**
117
+ * Window bounds rectangle
118
+ */
119
+ rect: {
120
+ left: number;
121
+ top: number;
122
+ right: number;
123
+ bottom: number;
124
+ };
125
+ /**
126
+ * Package name of the application that owns this window (may be null)
127
+ */
128
+ packageName: string | null;
129
+ /**
130
+ * Base64-encoded PNG screenshot of the window (may be null).
131
+ * Only available on Android API 34+ and when skipScreenshots is false.
132
+ */
133
+ screenshot: string | null;
134
+ }
package/lib/driver.ts CHANGED
@@ -113,6 +113,7 @@ import {
113
113
  suspendChromedriverProxy,
114
114
  mobileGetDeviceInfo,
115
115
  mobileResetAccessibilityCache,
116
+ mobileListWindows,
116
117
  } from './commands/misc';
117
118
  import {
118
119
  setUrl,
@@ -1057,6 +1058,7 @@ class AndroidUiautomator2Driver
1057
1058
  suspendChromedriverProxy = suspendChromedriverProxy as any;
1058
1059
  mobileGetDeviceInfo = mobileGetDeviceInfo;
1059
1060
  mobileResetAccessibilityCache = mobileResetAccessibilityCache;
1061
+ mobileListWindows = mobileListWindows;
1060
1062
 
1061
1063
  getClipboard = getClipboard;
1062
1064
  setClipboard = setClipboard;
@@ -263,4 +263,11 @@ export const executeMethodMap = {
263
263
  'mobile: resetAccessibilityCache': {
264
264
  command: 'mobileResetAccessibilityCache',
265
265
  },
266
+
267
+ 'mobile: listWindows': {
268
+ command: 'mobileListWindows',
269
+ params: {
270
+ optional: ['filters', 'skipScreenshots'],
271
+ },
272
+ },
266
273
  } as const satisfies ExecuteMethodMap<any>;
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "appium-uiautomator2-driver",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-uiautomator2-driver",
9
- "version": "6.4.0",
9
+ "version": "6.5.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "appium-adb": "^14.0.0",
13
13
  "appium-android-driver": "^12.3.0",
14
- "appium-uiautomator2-server": "^9.2.0",
14
+ "appium-uiautomator2-server": "^9.6.1",
15
15
  "asyncbox": "^3.0.0",
16
16
  "axios": "^1.12.2",
17
17
  "bluebird": "^3.5.1",
@@ -656,9 +656,9 @@
656
656
  }
657
657
  },
658
658
  "node_modules/appium-uiautomator2-server": {
659
- "version": "9.3.0",
660
- "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-9.3.0.tgz",
661
- "integrity": "sha512-JXyFhHZs4Bwbn+p08KCBJSuhM/U4zJep9FnDkkJdTgBO38CQDDOxXCyDEKQsqlTC2xeo5QjKvg7moGRptZWxXg==",
659
+ "version": "9.6.2",
660
+ "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-9.6.2.tgz",
661
+ "integrity": "sha512-rjCP15vwP9ePlIjpW/CxzfZ5FUXqkvVTA1zf3BcJwl7+B+ic/QVopxOyVJMhofjNatwp44Pua9kUwtdkGycltg==",
662
662
  "license": "Apache-2.0",
663
663
  "engines": {
664
664
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "automated testing",
8
8
  "android"
9
9
  ],
10
- "version": "6.4.0",
10
+ "version": "6.5.0",
11
11
  "bugs": {
12
12
  "url": "https://github.com/appium/appium-uiautomator2-driver/issues"
13
13
  },
@@ -58,7 +58,7 @@
58
58
  "dependencies": {
59
59
  "appium-adb": "^14.0.0",
60
60
  "appium-android-driver": "^12.3.0",
61
- "appium-uiautomator2-server": "^9.2.0",
61
+ "appium-uiautomator2-server": "^9.6.1",
62
62
  "asyncbox": "^3.0.0",
63
63
  "axios": "^1.12.2",
64
64
  "bluebird": "^3.5.1",