appium-uiautomator2-driver 6.4.1 → 6.6.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.
@@ -80,3 +80,105 @@ 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
+ }
135
+
136
+ export interface DisplayMetrics {
137
+ /**
138
+ * Display width in pixels
139
+ */
140
+ widthPixels: number;
141
+ /**
142
+ * Display height in pixels
143
+ */
144
+ heightPixels: number;
145
+ /**
146
+ * Display density (logical density factor)
147
+ */
148
+ density: number;
149
+ /**
150
+ * Display density in DPI
151
+ */
152
+ densityDpi: number;
153
+ /**
154
+ * Scaled density factor for fonts
155
+ */
156
+ scaledDensity: number;
157
+ /**
158
+ * Exact physical pixels per inch of the screen in the X dimension
159
+ */
160
+ xdpi: number;
161
+ /**
162
+ * Exact physical pixels per inch of the screen in the Y dimension
163
+ */
164
+ ydpi: number;
165
+ }
166
+
167
+ export interface DisplayInfo {
168
+ /**
169
+ * Display identifier (logical display ID)
170
+ */
171
+ id: number;
172
+ /**
173
+ * Physical display identifier (may be null). Returned as a string to avoid JavaScript number precision issues with large values.
174
+ */
175
+ physicalId: string | null;
176
+ /**
177
+ * Display metrics containing size and density information
178
+ */
179
+ metrics: DisplayMetrics;
180
+ /**
181
+ * Whether this is the default display
182
+ */
183
+ isDefault: boolean;
184
+ }
@@ -0,0 +1,35 @@
1
+ import type {AndroidUiautomator2Driver} from '../driver';
2
+ import type {WindowFilters, WindowInfo, DisplayInfo} from './types';
3
+
4
+ /**
5
+ * Gets a list of windows on all displays.
6
+ * For Android API 30+ (R), uses getWindowsOnAllDisplays().
7
+ * For older APIs, uses getWindows().
8
+ */
9
+ export async function mobileListWindows(
10
+ this: AndroidUiautomator2Driver,
11
+ filters?: WindowFilters,
12
+ skipScreenshots?: boolean
13
+ ): Promise<WindowInfo[]> {
14
+ return await this.uiautomator2.jwproxy.command(
15
+ '/appium/list_windows',
16
+ 'POST',
17
+ {
18
+ filters,
19
+ skipScreenshots,
20
+ }
21
+ ) as WindowInfo[];
22
+ }
23
+
24
+ /**
25
+ * Gets a list of all displays available on the device.
26
+ */
27
+ export async function mobileListDisplays(
28
+ this: AndroidUiautomator2Driver
29
+ ): Promise<DisplayInfo[]> {
30
+ return await this.uiautomator2.jwproxy.command(
31
+ '/appium/list_displays',
32
+ 'POST',
33
+ {}
34
+ ) as DisplayInfo[];
35
+ }
package/lib/driver.ts CHANGED
@@ -114,6 +114,10 @@ import {
114
114
  mobileGetDeviceInfo,
115
115
  mobileResetAccessibilityCache,
116
116
  } from './commands/misc';
117
+ import {
118
+ mobileListWindows,
119
+ mobileListDisplays,
120
+ } from './commands/windows';
117
121
  import {
118
122
  setUrl,
119
123
  mobileDeepLink,
@@ -1057,6 +1061,8 @@ class AndroidUiautomator2Driver
1057
1061
  suspendChromedriverProxy = suspendChromedriverProxy as any;
1058
1062
  mobileGetDeviceInfo = mobileGetDeviceInfo;
1059
1063
  mobileResetAccessibilityCache = mobileResetAccessibilityCache;
1064
+ mobileListWindows = mobileListWindows;
1065
+ mobileListDisplays = mobileListDisplays;
1060
1066
 
1061
1067
  getClipboard = getClipboard;
1062
1068
  setClipboard = setClipboard;
@@ -263,4 +263,15 @@ 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
+ },
273
+
274
+ 'mobile: listDisplays': {
275
+ command: 'mobileListDisplays',
276
+ },
266
277
  } as const satisfies ExecuteMethodMap<any>;
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "appium-uiautomator2-driver",
3
- "version": "6.4.1",
3
+ "version": "6.6.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-uiautomator2-driver",
9
- "version": "6.4.1",
9
+ "version": "6.6.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.3.1",
14
+ "appium-uiautomator2-server": "^9.7.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.1",
660
- "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-9.3.1.tgz",
661
- "integrity": "sha512-JE8Nf/5cEqW7hkYR+4KDAtzy+ym+tTdxe9Q6bIn9igoYT6dPORSGcRWyRxalu0cddL4E0wXY2YqI4FXfJ0ZJTA==",
659
+ "version": "9.7.1",
660
+ "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-9.7.1.tgz",
661
+ "integrity": "sha512-SXBoUMMtQAuBT5wsi1xNTx0t7kXwCeW/akZoBOGO3H2GCB32MWEL1fGkkVC1izljK2yHwItNmbR7ceUkOOx3jg==",
662
662
  "license": "Apache-2.0",
663
663
  "engines": {
664
664
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
@@ -1776,9 +1776,9 @@
1776
1776
  "license": "MIT"
1777
1777
  },
1778
1778
  "node_modules/finalhandler": {
1779
- "version": "2.1.0",
1780
- "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz",
1781
- "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==",
1779
+ "version": "2.1.1",
1780
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
1781
+ "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",
1782
1782
  "license": "MIT",
1783
1783
  "dependencies": {
1784
1784
  "debug": "^4.4.0",
@@ -1789,7 +1789,11 @@
1789
1789
  "statuses": "^2.0.1"
1790
1790
  },
1791
1791
  "engines": {
1792
- "node": ">= 0.8"
1792
+ "node": ">= 18.0.0"
1793
+ },
1794
+ "funding": {
1795
+ "type": "opencollective",
1796
+ "url": "https://opencollective.com/express"
1793
1797
  }
1794
1798
  },
1795
1799
  "node_modules/find-up": {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "automated testing",
8
8
  "android"
9
9
  ],
10
- "version": "6.4.1",
10
+ "version": "6.6.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.3.1",
61
+ "appium-uiautomator2-server": "^9.7.1",
62
62
  "asyncbox": "^3.0.0",
63
63
  "axios": "^1.12.2",
64
64
  "bluebird": "^3.5.1",