appium-desktop-driver 1.7.2-preview.1 → 1.7.2
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.
- package/README.md +2 -0
- package/build/eslint.config.d.mts +3 -0
- package/build/eslint.config.d.mts.map +1 -0
- package/build/eslint.config.mjs +22 -0
- package/build/eslint.config.mjs.map +1 -0
- package/build/lib/commands/actions.d.ts +3 -5
- package/build/lib/commands/actions.d.ts.map +1 -1
- package/build/lib/commands/actions.js +91 -83
- package/build/lib/commands/actions.js.map +1 -1
- package/build/lib/commands/app.d.ts +1 -53
- package/build/lib/commands/app.d.ts.map +1 -1
- package/build/lib/commands/app.js +147 -415
- package/build/lib/commands/app.js.map +1 -1
- package/build/lib/commands/device.d.ts +8 -0
- package/build/lib/commands/device.d.ts.map +1 -1
- package/build/lib/commands/device.js +229 -4
- package/build/lib/commands/device.js.map +1 -1
- package/build/lib/commands/element.d.ts +3 -0
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +53 -102
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/extension.d.ts +0 -2
- package/build/lib/commands/extension.d.ts.map +1 -1
- package/build/lib/commands/extension.js +184 -111
- package/build/lib/commands/extension.js.map +1 -1
- package/build/lib/commands/index.d.ts +17 -28
- package/build/lib/commands/index.d.ts.map +1 -1
- package/build/lib/commands/index.js +2 -4
- package/build/lib/commands/index.js.map +1 -1
- package/build/lib/commands/powershell.d.ts +6 -0
- package/build/lib/commands/powershell.d.ts.map +1 -0
- package/build/lib/commands/powershell.js +202 -0
- package/build/lib/commands/powershell.js.map +1 -0
- package/build/lib/commands/screen-recorder.d.ts +3 -3
- package/build/lib/commands/screen-recorder.d.ts.map +1 -1
- package/build/lib/commands/screen-recorder.js +24 -33
- package/build/lib/commands/screen-recorder.js.map +1 -1
- package/build/lib/constraints.d.ts +7 -26
- package/build/lib/constraints.d.ts.map +1 -1
- package/build/lib/constraints.js +6 -25
- package/build/lib/constraints.js.map +1 -1
- package/build/lib/driver.d.ts +13 -22
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +49 -130
- package/build/lib/driver.js.map +1 -1
- package/build/lib/mcp/tools/index.d.ts.map +1 -1
- package/build/lib/mcp/tools/index.js +0 -2
- package/build/lib/mcp/tools/index.js.map +1 -1
- package/build/lib/powershell/conditions.d.ts.map +1 -1
- package/build/lib/powershell/conditions.js +0 -7
- package/build/lib/powershell/conditions.js.map +1 -1
- package/build/lib/util.d.ts +1 -11
- package/build/lib/util.d.ts.map +1 -1
- package/build/lib/util.js +7 -158
- package/build/lib/util.js.map +1 -1
- package/build/lib/winapi/user32.d.ts +6 -5
- package/build/lib/winapi/user32.d.ts.map +1 -1
- package/build/lib/winapi/user32.js +88 -131
- package/build/lib/winapi/user32.js.map +1 -1
- package/build/lib/xpath/core.d.ts +4 -10
- package/build/lib/xpath/core.d.ts.map +1 -1
- package/build/lib/xpath/core.js +224 -205
- package/build/lib/xpath/core.js.map +1 -1
- package/build/lib/xpath/functions.d.ts +2 -7
- package/build/lib/xpath/functions.d.ts.map +1 -1
- package/build/lib/xpath/functions.js +25 -49
- package/build/lib/xpath/functions.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +12 -18
- package/CHANGELOG.md +0 -249
- package/build/lib/commands/contexts.d.ts +0 -64
- package/build/lib/commands/contexts.d.ts.map +0 -1
- package/build/lib/commands/contexts.js +0 -166
- package/build/lib/commands/contexts.js.map +0 -1
- package/build/lib/commands/server-session.d.ts +0 -9
- package/build/lib/commands/server-session.d.ts.map +0 -1
- package/build/lib/commands/server-session.js +0 -158
- package/build/lib/commands/server-session.js.map +0 -1
- package/build/lib/log-file.d.ts +0 -10
- package/build/lib/log-file.d.ts.map +0 -1
- package/build/lib/log-file.js +0 -86
- package/build/lib/log-file.js.map +0 -1
- package/build/lib/mcp/tools/context.d.ts +0 -4
- package/build/lib/mcp/tools/context.d.ts.map +0 -1
- package/build/lib/mcp/tools/context.js +0 -49
- package/build/lib/mcp/tools/context.js.map +0 -1
- package/build/lib/server/client.d.ts +0 -15
- package/build/lib/server/client.d.ts.map +0 -1
- package/build/lib/server/client.js +0 -169
- package/build/lib/server/client.js.map +0 -1
- package/build/lib/server/conditions.d.ts +0 -13
- package/build/lib/server/conditions.d.ts.map +0 -1
- package/build/lib/server/conditions.js +0 -71
- package/build/lib/server/conditions.js.map +0 -1
- package/build/lib/server/converter-bridge.d.ts +0 -26
- package/build/lib/server/converter-bridge.d.ts.map +0 -1
- package/build/lib/server/converter-bridge.js +0 -171
- package/build/lib/server/converter-bridge.js.map +0 -1
- package/build/lib/server/index.d.ts +0 -5
- package/build/lib/server/index.d.ts.map +0 -1
- package/build/lib/server/index.js +0 -25
- package/build/lib/server/index.js.map +0 -1
- package/build/lib/server/protocol.d.ts +0 -40
- package/build/lib/server/protocol.d.ts.map +0 -1
- package/build/lib/server/protocol.js +0 -3
- package/build/lib/server/protocol.js.map +0 -1
- package/build/lib/version.d.ts +0 -2
- package/build/lib/version.d.ts.map +0 -1
- package/build/lib/version.js +0 -20
- package/build/lib/version.js.map +0 -1
- package/scripts/postinstall.js +0 -39
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../lib/commands/element.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../lib/commands/element.ts"],"names":[],"mappings":";;AAqBA,kCAEC;AAED,oCAGC;AAED,wBAEC;AAED,0BAEC;AAED,0BAEC;AAED,sBAEC;AAED,4BAqHC;AAUQ,4CAAgB;AAEzB,wCAQC;AAED,4CAGC;AAGD,0CAQC;AAED,wCAGC;AAED,sBA4CC;AAeD,oDAQC;AA/QD,8CAauB;AACvB,qDAA8D;AAC9D,6CAAyE;AACzE,oCAA+B;AAC/B,kCAAgC;AAEzB,KAAK,UAAU,WAAW,CAA4B,YAAoB,EAAE,SAAiB;IAChG,OAAO,MAAM,IAAI,C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,KAAK,GAAG,CAAC,CAAC;QACxC,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,IAAA,0BAAiB,EAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,EAAE,cAAc,CAAC,CAAC;IAEvG,IAAA,kBAAS,GAAE,CAAC;IACZ,IAAA,gBAAO,GAAE,CAAC;IAEV,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;QAC5B,MAAM,IAAA,YAAK,EAAC,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;AACL,CAAC;AAED,MAAM,8BAA8B,GAAG,IAAA,kBAAK,CAAC,SAAS,EAAC;iBACtC,CAAC;;;;;;;;;;CAUjB,CAAC;AAEK,KAAK,UAAU,oBAAoB,CAA4B,SAAiB;IACnF,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,qBAAqB,CAAC,8BAAiB,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1G,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,MAAM,IAAI,oBAAM,CAAC,iBAAiB,CAAC,0CAA0C,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,MAAM,IAAI,CAAC,qBAAqB,CACnC,8BAA8B,CAAC,MAAM,CAAC,IAAI,mCAAsB,CAAC,SAAS,CAAC,CAAC,CAC/E,CAAC;AACN,CAAC"}
|
|
@@ -120,8 +120,6 @@ export declare function windowsGetDeviceTime(this: AppiumDesktopDriver, args?: {
|
|
|
120
120
|
format?: string;
|
|
121
121
|
}): Promise<string>;
|
|
122
122
|
export declare function getWindowElement(this: AppiumDesktopDriver): Promise<Element>;
|
|
123
|
-
export declare function pushFile(this: AppiumDesktopDriver, remotePath: string, base64Data: string): Promise<void>;
|
|
124
|
-
export declare function pullFile(this: AppiumDesktopDriver, remotePath: string): Promise<string>;
|
|
125
123
|
export declare function windowsGetMonitors(this: AppiumDesktopDriver): Promise<object[]>;
|
|
126
124
|
export declare function executeGetDpiScale(): number;
|
|
127
125
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../lib/commands/extension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../lib/commands/extension.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAQ,MAAM,eAAe,CAAC;AAI9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAO,MAAM,UAAU,CAAC;AAchD,OAAO,EAA+B,aAAa,EAAuB,MAAM,mBAAmB,CAAC;AAuDpG,QAAA,MAAM,WAAW;;;EAGN,CAAC;AAEZ,KAAK,WAAW,GAAG,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AA0B5C,KAAK,SAAS,GAAG;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAA;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,gBAqBnF;AAED,KAAK,YAAY,GAAG;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAA;AAKD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAk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
|
|
38
38
|
exports.getWindowElement = getWindowElement;
|
|
39
|
-
exports.pushFile = pushFile;
|
|
40
|
-
exports.pullFile = pullFile;
|
|
41
39
|
exports.windowsGetMonitors = windowsGetMonitors;
|
|
42
40
|
exports.executeGetDpiScale = executeGetDpiScale;
|
|
43
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
44
41
|
const base_driver_1 = require("@appium/base-driver");
|
|
45
|
-
const promises_1 = require("node:fs/promises");
|
|
46
42
|
const node_os_1 = require("node:os");
|
|
47
43
|
const node_path_1 = require("node:path");
|
|
48
44
|
const constants_1 = require("../constants");
|
|
49
45
|
const enums_1 = require("../enums");
|
|
50
|
-
const
|
|
51
|
-
const converter_bridge_1 = require("../server/converter-bridge");
|
|
52
|
-
const converter_1 = require("../powershell/converter");
|
|
46
|
+
const powershell_1 = require("../powershell");
|
|
53
47
|
const util_1 = require("../util");
|
|
54
48
|
const screen_recorder_1 = require("./screen-recorder");
|
|
55
49
|
const types_1 = require("../winapi/types");
|
|
@@ -98,6 +92,27 @@ const ContentType = Object.freeze({
|
|
|
98
92
|
PLAINTEXT: 'plaintext',
|
|
99
93
|
IMAGE: 'image',
|
|
100
94
|
});
|
|
95
|
+
const TREE_FILTER_COMMAND = (0, util_1.$ /* ps1 */) `$cacheRequest.Pop(); $cacheRequest.TreeFilter = ${0}; $cacheRequest.Push()`;
|
|
96
|
+
const TREE_SCOPE_COMMAND = (0, util_1.$ /* ps1 */) `$cacheRequest.Pop(); $cacheRequest.TreeScope = ${0}; $cacheRequest.Push()`;
|
|
97
|
+
const AUTOMATION_ELEMENT_MODE = (0, util_1.$ /* ps1 */) `$cacheRequest.Pop(); $cacheRequest.AutomationElementMode = ${0}; $cacheRequest.Push()`;
|
|
98
|
+
const SET_PLAINTEXT_CLIPBOARD_FROM_BASE64 = (0, util_1.$ /* ps1 */) `Set-Clipboard -Value ([System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String(${0})))`;
|
|
99
|
+
const GET_PLAINTEXT_CLIPBOARD_BASE64 = /* ps1 */ `[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes((Get-Clipboard)))`;
|
|
100
|
+
const SET_IMAGE_CLIPBOARD_FROM_BASE64 = (0, util_1.$ /* ps1 */) `$b = [Convert]::FromBase64String(${0}); $s = New-Object IO.MemoryStream; $s.Write($b, 0, $b.Length); $s.Position = 0; $i = [System.Windows.Media.Imaging.BitmapFrame]::Create($s); [Windows.Clipboard]::SetImage($i); $s.Close()`;
|
|
101
|
+
const GET_IMAGE_CLIPBOARD_BASE64 = (0, powershell_1.pwsh /* ps1 */) `
|
|
102
|
+
[Windows.Clipboard]::GetImage() | ForEach-Object {
|
|
103
|
+
if ($_ -ne $null) {
|
|
104
|
+
$stream = New-Object IO.MemoryStream
|
|
105
|
+
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder
|
|
106
|
+
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($_))
|
|
107
|
+
$encoder.Save($stream)
|
|
108
|
+
$stream.Position = 0
|
|
109
|
+
$bytes = $stream.ToArray()
|
|
110
|
+
$base64String = [Convert]::ToBase64String($bytes)
|
|
111
|
+
$stream.Close()
|
|
112
|
+
Write-Output $base64String
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
101
116
|
async function execute(script, args) {
|
|
102
117
|
if (script.startsWith(PLATFORM_COMMAND_PREFIX)) {
|
|
103
118
|
script = script.replace(PLATFORM_COMMAND_PREFIX, '').trim();
|
|
@@ -107,109 +122,108 @@ async function execute(script, args) {
|
|
|
107
122
|
}
|
|
108
123
|
return await this[EXTENSION_COMMANDS[script]](...args);
|
|
109
124
|
}
|
|
110
|
-
if (script.replace(/\s/g, '') === 'mobile:getContexts') {
|
|
111
|
-
if (!this.caps.webviewEnabled) {
|
|
112
|
-
throw new base_driver_1.errors.InvalidArgumentError('WebView support is not enabled. To use this command, enable WebView support by setting the "webviewEnabled" capability to true.');
|
|
113
|
-
}
|
|
114
|
-
const { waitForWebviewMs } = args[0] || {};
|
|
115
|
-
const webViewDetails = await this.getWebViewDetails(waitForWebviewMs);
|
|
116
|
-
return [{
|
|
117
|
-
id: 'NATIVE_APP',
|
|
118
|
-
}, ...(webViewDetails.pages ?? []).map((page) => ({ ...page, id: `WEBVIEW_${page.id}` }))];
|
|
119
|
-
}
|
|
120
125
|
if (script === 'powerShell') {
|
|
121
126
|
return await this.executePowerShellScript(args[0]);
|
|
122
127
|
}
|
|
123
|
-
if (this.chromedriver && this.proxyActive()) {
|
|
124
|
-
const endpoint = this.chromedriver.jwproxy.downstreamProtocol === base_driver_1.PROTOCOLS.MJSONWP
|
|
125
|
-
? '/execute'
|
|
126
|
-
: '/execute/sync';
|
|
127
|
-
return await this.chromedriver.jwproxy.command(endpoint, 'POST', { script, args });
|
|
128
|
-
}
|
|
129
128
|
if (script === 'return window.name') {
|
|
130
|
-
|
|
131
|
-
return await this.sendCommand('getProperty', { elementId: rootId, property: 'Name' });
|
|
129
|
+
return await this.sendPowerShellCommand(powershell_1.AutomationElement.automationRoot.buildGetPropertyCommand(powershell_1.Property.NAME));
|
|
132
130
|
}
|
|
133
131
|
throw new base_driver_1.errors.NotImplementedError();
|
|
134
132
|
}
|
|
135
133
|
;
|
|
134
|
+
const TREE_SCOPE_REGEX = new powershell_1.PropertyRegexMatcher('System.Windows.Automation.TreeScope', ...Object.values(powershell_1.TreeScope)).toRegex('i');
|
|
135
|
+
const AUTOMATION_ELEMENT_MODE_REGEX = new powershell_1.PropertyRegexMatcher('System.Windows.Automation.AutomationElementMode', ...Object.values(powershell_1.AutomationElementMode)).toRegex('i');
|
|
136
136
|
async function pushCacheRequest(cacheRequest) {
|
|
137
137
|
if (Object.keys(cacheRequest).every((key) => cacheRequest[key] === undefined)) {
|
|
138
138
|
throw new base_driver_1.errors.InvalidArgumentError('At least one property of the cache request must be set.');
|
|
139
139
|
}
|
|
140
140
|
if (cacheRequest.treeFilter) {
|
|
141
|
-
|
|
142
|
-
await this.sendCommand('setCacheRequestTreeFilter', { condition: (0, converter_bridge_1.conditionToDto)(condition) });
|
|
141
|
+
await this.sendPowerShellCommand(TREE_FILTER_COMMAND.format((0, powershell_1.convertStringToCondition)(cacheRequest.treeFilter)));
|
|
143
142
|
}
|
|
144
143
|
if (cacheRequest.treeScope) {
|
|
145
|
-
|
|
144
|
+
const treeScope = TREE_SCOPE_REGEX.exec(cacheRequest.treeScope)?.[1];
|
|
145
|
+
if (!treeScope || (Number(cacheRequest.treeScope) < 1 && Number(cacheRequest.treeScope) > 16)) {
|
|
146
|
+
throw new base_driver_1.errors.InvalidArgumentError(`Invalid value '${cacheRequest.treeScope}' passed to TreeScope for cache request.`);
|
|
147
|
+
}
|
|
148
|
+
await this.sendPowerShellCommand(TREE_SCOPE_COMMAND.format(isNaN(Number(cacheRequest.treeScope)) ? /* ps1 */ `[TreeScope]::${cacheRequest.treeScope}` : cacheRequest.treeScope));
|
|
146
149
|
}
|
|
147
150
|
if (cacheRequest.automationElementMode) {
|
|
148
|
-
|
|
151
|
+
const treeScope = AUTOMATION_ELEMENT_MODE_REGEX.exec(cacheRequest.automationElementMode)?.[1];
|
|
152
|
+
if (!treeScope || (Number(cacheRequest.automationElementMode) < 0 && Number(cacheRequest.automationElementMode) > 1)) {
|
|
153
|
+
throw new base_driver_1.errors.InvalidArgumentError(`Invalid value '${cacheRequest.automationElementMode}' passed to AutomationElementMode for cache request.`);
|
|
154
|
+
}
|
|
155
|
+
let automationElementMode;
|
|
156
|
+
if (isNaN(Number(cacheRequest.automationElementMode))) {
|
|
157
|
+
automationElementMode = /* ps1 */ `[AutomationElementMode]::${cacheRequest.automationElementMode}`;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
automationElementMode = cacheRequest.automationElementMode;
|
|
161
|
+
}
|
|
162
|
+
await this.sendPowerShellCommand(AUTOMATION_ELEMENT_MODE.format(automationElementMode));
|
|
149
163
|
}
|
|
150
164
|
}
|
|
151
165
|
async function patternInvoke(element) {
|
|
152
|
-
await this.
|
|
166
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildInvokeCommand());
|
|
153
167
|
}
|
|
154
168
|
async function patternExpand(element) {
|
|
155
|
-
await this.
|
|
169
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildExpandCommand());
|
|
156
170
|
}
|
|
157
171
|
async function patternCollapse(element) {
|
|
158
|
-
await this.
|
|
172
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildCollapseCommand());
|
|
159
173
|
}
|
|
160
174
|
async function patternScrollIntoView(element) {
|
|
161
|
-
await this.
|
|
175
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildScrollIntoViewCommand());
|
|
162
176
|
}
|
|
163
177
|
async function patternIsMultiple(element) {
|
|
164
|
-
const result = await this.
|
|
165
|
-
return result
|
|
178
|
+
const result = await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildIsMultipleSelectCommand());
|
|
179
|
+
return result.toLowerCase() === 'true' ? true : false;
|
|
166
180
|
}
|
|
167
181
|
async function patternGetSelectedItem(element) {
|
|
168
|
-
const result = await this.
|
|
169
|
-
const elId = result
|
|
182
|
+
const result = await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildGetSelectionCommand());
|
|
183
|
+
const elId = result.split('\n').filter(Boolean)[0];
|
|
170
184
|
if (!elId) {
|
|
171
185
|
throw new base_driver_1.errors.NoSuchElementError();
|
|
172
186
|
}
|
|
173
187
|
return { [base_driver_1.W3C_ELEMENT_KEY]: elId };
|
|
174
188
|
}
|
|
175
189
|
async function patternGetAllSelectedItems(element) {
|
|
176
|
-
const result = await this.
|
|
177
|
-
return (
|
|
190
|
+
const result = await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildGetSelectionCommand());
|
|
191
|
+
return result.split('\n').filter(Boolean).map((elId) => ({ [base_driver_1.W3C_ELEMENT_KEY]: elId }));
|
|
178
192
|
}
|
|
179
193
|
async function patternAddToSelection(element) {
|
|
180
|
-
await this.
|
|
194
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildAddToSelectionCommand());
|
|
181
195
|
}
|
|
182
196
|
async function patternRemoveFromSelection(element) {
|
|
183
|
-
await this.
|
|
197
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildRemoveFromSelectionCommand());
|
|
184
198
|
}
|
|
185
199
|
async function patternSelect(element) {
|
|
186
|
-
await this.
|
|
200
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildSelectCommand());
|
|
187
201
|
}
|
|
188
202
|
async function patternToggle(element) {
|
|
189
|
-
await this.
|
|
203
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildToggleCommand());
|
|
190
204
|
}
|
|
191
205
|
async function patternSetValue(element, value) {
|
|
192
206
|
try {
|
|
193
|
-
await this.
|
|
207
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildSetValueCommand(value));
|
|
194
208
|
}
|
|
195
209
|
catch {
|
|
196
|
-
await this.
|
|
210
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildSetRangeValueCommand(value));
|
|
197
211
|
}
|
|
198
212
|
}
|
|
199
213
|
async function patternGetValue(element) {
|
|
200
|
-
return await this.
|
|
214
|
+
return await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildGetValueCommand());
|
|
201
215
|
}
|
|
202
216
|
async function patternMaximize(element) {
|
|
203
|
-
await this.
|
|
217
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildMaximizeCommand());
|
|
204
218
|
}
|
|
205
219
|
async function patternMinimize(element) {
|
|
206
|
-
await this.
|
|
220
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildMinimizeCommand());
|
|
207
221
|
}
|
|
208
222
|
async function patternRestore(element) {
|
|
209
|
-
await this.
|
|
223
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildRestoreCommand());
|
|
210
224
|
}
|
|
211
225
|
async function patternClose(element) {
|
|
212
|
-
await this.
|
|
226
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildCloseCommand());
|
|
213
227
|
}
|
|
214
228
|
async function windowsCloseApp() {
|
|
215
229
|
return await this.closeApp();
|
|
@@ -218,7 +232,7 @@ async function windowsLaunchApp() {
|
|
|
218
232
|
return await this.launchApp();
|
|
219
233
|
}
|
|
220
234
|
async function focusElement(element) {
|
|
221
|
-
await this.
|
|
235
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(element[base_driver_1.W3C_ELEMENT_KEY]).buildSetFocusCommand());
|
|
222
236
|
}
|
|
223
237
|
async function getClipboardBase64(contentType) {
|
|
224
238
|
if (!contentType || (contentType && typeof contentType === 'object')) {
|
|
@@ -226,9 +240,9 @@ async function getClipboardBase64(contentType) {
|
|
|
226
240
|
}
|
|
227
241
|
switch (contentType.toLowerCase()) {
|
|
228
242
|
case ContentType.PLAINTEXT:
|
|
229
|
-
return await this.
|
|
243
|
+
return await this.sendPowerShellCommand(GET_PLAINTEXT_CLIPBOARD_BASE64);
|
|
230
244
|
case ContentType.IMAGE:
|
|
231
|
-
return await this.
|
|
245
|
+
return await this.sendPowerShellCommand(GET_IMAGE_CLIPBOARD_BASE64);
|
|
232
246
|
default:
|
|
233
247
|
throw new base_driver_1.errors.InvalidArgumentError(`Unsupported content type '${contentType}'.`);
|
|
234
248
|
}
|
|
@@ -240,11 +254,9 @@ async function setClipboardFromBase64(args) {
|
|
|
240
254
|
const contentType = args.contentType ?? ContentType.PLAINTEXT;
|
|
241
255
|
switch (contentType.toLowerCase()) {
|
|
242
256
|
case ContentType.PLAINTEXT:
|
|
243
|
-
await this.
|
|
244
|
-
return '';
|
|
257
|
+
return await this.sendPowerShellCommand(SET_PLAINTEXT_CLIPBOARD_FROM_BASE64.format(`'${args.b64Content}'`));
|
|
245
258
|
case ContentType.IMAGE:
|
|
246
|
-
await this.
|
|
247
|
-
return '';
|
|
259
|
+
return await this.sendPowerShellCommand(SET_IMAGE_CLIPBOARD_FROM_BASE64.format(`'${args.b64Content}'`));
|
|
248
260
|
default:
|
|
249
261
|
throw new base_driver_1.errors.InvalidArgumentError(`Unsupported content type '${contentType}'.`);
|
|
250
262
|
}
|
|
@@ -261,11 +273,13 @@ async function executePowerShellScript(script) {
|
|
|
261
273
|
throw new base_driver_1.errors.InvalidArgumentError('Either script or command must be provided.');
|
|
262
274
|
}
|
|
263
275
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
276
|
+
const scriptToExecute = (0, powershell_1.pwsh) `${script}`;
|
|
277
|
+
if (this.caps.isolatedScriptExecution) {
|
|
278
|
+
return await this.sendIsolatedPowerShellCommand(scriptToExecute);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
return await this.sendPowerShellCommand(scriptToExecute);
|
|
282
|
+
}
|
|
269
283
|
}
|
|
270
284
|
async function executeKeys(keyActions) {
|
|
271
285
|
if (!Array.isArray(keyActions.actions)) {
|
|
@@ -323,24 +337,6 @@ async function executeKeys(keyActions) {
|
|
|
323
337
|
}
|
|
324
338
|
}
|
|
325
339
|
}
|
|
326
|
-
async function getElementPos(driver, elementId, offsetX, offsetY) {
|
|
327
|
-
const exists = await driver.sendCommand('lookupElement', { elementId });
|
|
328
|
-
if (!exists) {
|
|
329
|
-
const elId = await driver.sendCommand('findElement', {
|
|
330
|
-
scope: 'subtree',
|
|
331
|
-
condition: (0, conditions_1.propertyCondition)('RuntimeId', elementId.split('.').map(Number)),
|
|
332
|
-
contextElementId: null,
|
|
333
|
-
});
|
|
334
|
-
if (!elId || elId.trim() === '') {
|
|
335
|
-
throw new base_driver_1.errors.NoSuchElementError();
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
const rect = await driver.sendCommand('getRect', { elementId });
|
|
339
|
-
return [
|
|
340
|
-
rect.x + (offsetX ?? Math.trunc(rect.width / 2)),
|
|
341
|
-
rect.y + (offsetY ?? Math.trunc(rect.height / 2)),
|
|
342
|
-
];
|
|
343
|
-
}
|
|
344
340
|
async function executeClick(clickArgs) {
|
|
345
341
|
const { elementId, x, y, button = enums_1.ClickType.LEFT, modifierKeys = [], durationMs = 0, times = 1, interClickDelayMs = 100, } = clickArgs;
|
|
346
342
|
if ((x != null) !== (y != null)) {
|
|
@@ -348,9 +344,22 @@ async function executeClick(clickArgs) {
|
|
|
348
344
|
}
|
|
349
345
|
let pos;
|
|
350
346
|
if (elementId) {
|
|
351
|
-
|
|
347
|
+
if (await this.sendPowerShellCommand(/* ps1 */ `$null -eq ${new powershell_1.FoundAutomationElement(elementId).toString()}`)) {
|
|
348
|
+
const condition = new powershell_1.PropertyCondition(powershell_1.Property.RUNTIME_ID, new powershell_1.PSInt32Array(elementId.split('.').map(Number)));
|
|
349
|
+
const elId = await this.sendPowerShellCommand(powershell_1.AutomationElement.automationRoot.findFirst(powershell_1.TreeScope.SUBTREE, condition).buildCommand());
|
|
350
|
+
if (elId.trim() === '') {
|
|
351
|
+
throw new base_driver_1.errors.NoSuchElementError();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const rectJson = await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(elementId).buildGetElementRectCommand());
|
|
355
|
+
const rect = JSON.parse(rectJson.replaceAll(/(?:infinity)/gi, 0x7FFFFFFF.toString()));
|
|
356
|
+
pos = [
|
|
357
|
+
rect.x + (x ?? Math.trunc(rect.width / 2)),
|
|
358
|
+
rect.y + (y ?? Math.trunc(rect.height / 2)),
|
|
359
|
+
];
|
|
352
360
|
}
|
|
353
361
|
else {
|
|
362
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
354
363
|
pos = [x, y];
|
|
355
364
|
}
|
|
356
365
|
const clickTypeToButtonMapping = {
|
|
@@ -412,16 +421,42 @@ async function executeHover(hoverArgs) {
|
|
|
412
421
|
const processesModifierKeys = Array.isArray(modifierKeys) ? modifierKeys : [modifierKeys];
|
|
413
422
|
let startPos;
|
|
414
423
|
if (startElementId) {
|
|
415
|
-
|
|
424
|
+
if (await this.sendPowerShellCommand(/* ps1 */ `$null -eq ${new powershell_1.FoundAutomationElement(startElementId).toString()}`)) {
|
|
425
|
+
const condition = new powershell_1.PropertyCondition(powershell_1.Property.RUNTIME_ID, new powershell_1.PSInt32Array(startElementId.split('.').map(Number)));
|
|
426
|
+
const elId = await this.sendPowerShellCommand(powershell_1.AutomationElement.automationRoot.findFirst(powershell_1.TreeScope.SUBTREE, condition).buildCommand());
|
|
427
|
+
if (elId.trim() === '') {
|
|
428
|
+
throw new base_driver_1.errors.NoSuchElementError();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
const rectJson = await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(startElementId).buildGetElementRectCommand());
|
|
432
|
+
const rect = JSON.parse(rectJson.replaceAll(/(?:infinity)/gi, 0x7FFFFFFF.toString()));
|
|
433
|
+
startPos = [
|
|
434
|
+
rect.x + (startX ?? rect.width / 2),
|
|
435
|
+
rect.y + (startY ?? rect.height / 2)
|
|
436
|
+
];
|
|
416
437
|
}
|
|
417
438
|
else {
|
|
439
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
418
440
|
startPos = [startX, startY];
|
|
419
441
|
}
|
|
420
442
|
let endPos;
|
|
421
443
|
if (endElementId) {
|
|
422
|
-
|
|
444
|
+
if (await this.sendPowerShellCommand(/* ps1 */ `$null -eq ${new powershell_1.FoundAutomationElement(endElementId).toString()}`)) {
|
|
445
|
+
const condition = new powershell_1.PropertyCondition(powershell_1.Property.RUNTIME_ID, new powershell_1.PSInt32Array(endElementId.split('.').map(Number)));
|
|
446
|
+
const elId = await this.sendPowerShellCommand(powershell_1.AutomationElement.automationRoot.findFirst(powershell_1.TreeScope.SUBTREE, condition).buildCommand());
|
|
447
|
+
if (elId.trim() === '') {
|
|
448
|
+
throw new base_driver_1.errors.NoSuchElementError();
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
const rectJson = await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(endElementId).buildGetElementRectCommand());
|
|
452
|
+
const rect = JSON.parse(rectJson.replaceAll(/(?:infinity)/gi, 0x7FFFFFFF.toString()));
|
|
453
|
+
endPos = [
|
|
454
|
+
rect.x + (endX ?? rect.width / 2),
|
|
455
|
+
rect.y + (endY ?? rect.height / 2)
|
|
456
|
+
];
|
|
423
457
|
}
|
|
424
458
|
else {
|
|
459
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
425
460
|
endPos = [endX, endY];
|
|
426
461
|
}
|
|
427
462
|
await (0, user32_1.mouseMoveAbsolute)(startPos[0], startPos[1], 0);
|
|
@@ -462,9 +497,19 @@ async function executeScroll(scrollArgs) {
|
|
|
462
497
|
const processesModifierKeys = Array.isArray(modifierKeys) ? modifierKeys : [modifierKeys];
|
|
463
498
|
let pos;
|
|
464
499
|
if (elementId) {
|
|
465
|
-
|
|
500
|
+
if (await this.sendPowerShellCommand(/* ps1 */ `$null -eq ${new powershell_1.FoundAutomationElement(elementId).toString()}`)) {
|
|
501
|
+
const condition = new powershell_1.PropertyCondition(powershell_1.Property.RUNTIME_ID, new powershell_1.PSInt32Array(elementId.split('.').map(Number)));
|
|
502
|
+
const elId = await this.sendPowerShellCommand(powershell_1.AutomationElement.automationRoot.findFirst(powershell_1.TreeScope.SUBTREE, condition).buildCommand());
|
|
503
|
+
if (elId.trim() === '') {
|
|
504
|
+
throw new base_driver_1.errors.NoSuchElementError();
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
const rectJson = await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(elementId).buildGetElementRectCommand());
|
|
508
|
+
const rect = JSON.parse(rectJson.replaceAll(/(?:infinity)/gi, 0x7FFFFFFF.toString()));
|
|
509
|
+
pos = [rect.x + (rect.width / 2), rect.y + (rect.height / 2)];
|
|
466
510
|
}
|
|
467
511
|
else {
|
|
512
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
468
513
|
pos = [x, y];
|
|
469
514
|
}
|
|
470
515
|
await (0, user32_1.mouseMoveAbsolute)(pos[0], pos[1], 0);
|
|
@@ -517,7 +562,7 @@ async function startRecordingScreen(args) {
|
|
|
517
562
|
}
|
|
518
563
|
}
|
|
519
564
|
const videoPath = outputPath ?? (0, node_path_1.join)((0, node_os_1.tmpdir)(), `appiumdesktop-recording-${Date.now()}.${screen_recorder_1.DEFAULT_EXT}`);
|
|
520
|
-
this._screenRecorder = new screen_recorder_1.ScreenRecorder(videoPath, this, {
|
|
565
|
+
this._screenRecorder = new screen_recorder_1.ScreenRecorder(videoPath, this.log, {
|
|
521
566
|
fps: fps !== undefined ? parseInt(String(fps), 10) : undefined,
|
|
522
567
|
timeLimit: timeLimit !== undefined ? parseInt(String(timeLimit), 10) : undefined,
|
|
523
568
|
preset,
|
|
@@ -553,14 +598,22 @@ async function deleteFile(args) {
|
|
|
553
598
|
if (!args || typeof args !== 'object' || !args.path) {
|
|
554
599
|
throw new base_driver_1.errors.InvalidArgumentError("'path' must be provided.");
|
|
555
600
|
}
|
|
556
|
-
|
|
601
|
+
const escapedPath = args.path.replace(/'/g, "''");
|
|
602
|
+
const useLiteralPath = /[[\][]?]/.test(args.path);
|
|
603
|
+
const pathParam = useLiteralPath ? `-LiteralPath '${escapedPath}'` : `-Path '${escapedPath}'`;
|
|
604
|
+
await this.sendPowerShellCommand(`Remove-Item ${pathParam} -Force -ErrorAction Stop`);
|
|
557
605
|
}
|
|
558
606
|
async function deleteFolder(args) {
|
|
559
607
|
this.assertFeatureEnabled(constants_1.MODIFY_FS_FEATURE);
|
|
560
608
|
if (!args || typeof args !== 'object' || !args.path) {
|
|
561
609
|
throw new base_driver_1.errors.InvalidArgumentError("'path' must be provided.");
|
|
562
610
|
}
|
|
563
|
-
|
|
611
|
+
const { path: pathArg, recursive = true } = args;
|
|
612
|
+
const escapedPath = pathArg.replace(/'/g, "''");
|
|
613
|
+
const useLiteralPath = /[[\][]?]/.test(pathArg);
|
|
614
|
+
const pathParam = useLiteralPath ? `-LiteralPath '${escapedPath}'` : `-Path '${escapedPath}'`;
|
|
615
|
+
const recurseFlag = recursive ? ' -Recurse' : '';
|
|
616
|
+
await this.sendPowerShellCommand(`Remove-Item ${pathParam} -Force${recurseFlag} -ErrorAction Stop`);
|
|
564
617
|
}
|
|
565
618
|
async function executeClickAndDrag(dragArgs) {
|
|
566
619
|
const { startElementId, startX, startY, endElementId, endX, endY, modifierKeys = [], durationMs = 500, button = enums_1.ClickType.LEFT, } = dragArgs ?? {};
|
|
@@ -581,7 +634,19 @@ async function executeClickAndDrag(dragArgs) {
|
|
|
581
634
|
const mouseButton = clickTypeToButtonMapping[button];
|
|
582
635
|
let startPos;
|
|
583
636
|
if (startElementId) {
|
|
584
|
-
|
|
637
|
+
if (await this.sendPowerShellCommand(/* ps1 */ `$null -eq ${new powershell_1.FoundAutomationElement(startElementId).toString()}`)) {
|
|
638
|
+
const condition = new powershell_1.PropertyCondition(powershell_1.Property.RUNTIME_ID, new powershell_1.PSInt32Array(startElementId.split('.').map(Number)));
|
|
639
|
+
const elId = await this.sendPowerShellCommand(powershell_1.AutomationElement.automationRoot.findFirst(powershell_1.TreeScope.SUBTREE, condition).buildCommand());
|
|
640
|
+
if (elId.trim() === '') {
|
|
641
|
+
throw new base_driver_1.errors.NoSuchElementError();
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
const rectJson = await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(startElementId).buildGetElementRectCommand());
|
|
645
|
+
const rect = JSON.parse(rectJson.replaceAll(/(?:infinity)/gi, 0x7FFFFFFF.toString()));
|
|
646
|
+
startPos = [
|
|
647
|
+
rect.x + (startX ?? rect.width / 2),
|
|
648
|
+
rect.y + (startY ?? rect.height / 2)
|
|
649
|
+
];
|
|
585
650
|
}
|
|
586
651
|
else {
|
|
587
652
|
if (startX == null || startY == null) {
|
|
@@ -591,7 +656,19 @@ async function executeClickAndDrag(dragArgs) {
|
|
|
591
656
|
}
|
|
592
657
|
let endPos;
|
|
593
658
|
if (endElementId) {
|
|
594
|
-
|
|
659
|
+
if (await this.sendPowerShellCommand(/* ps1 */ `$null -eq ${new powershell_1.FoundAutomationElement(endElementId).toString()}`)) {
|
|
660
|
+
const condition = new powershell_1.PropertyCondition(powershell_1.Property.RUNTIME_ID, new powershell_1.PSInt32Array(endElementId.split('.').map(Number)));
|
|
661
|
+
const elId = await this.sendPowerShellCommand(powershell_1.AutomationElement.automationRoot.findFirst(powershell_1.TreeScope.SUBTREE, condition).buildCommand());
|
|
662
|
+
if (elId.trim() === '') {
|
|
663
|
+
throw new base_driver_1.errors.NoSuchElementError();
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
const rectJson = await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(endElementId).buildGetElementRectCommand());
|
|
667
|
+
const rect = JSON.parse(rectJson.replaceAll(/(?:infinity)/gi, 0x7FFFFFFF.toString()));
|
|
668
|
+
endPos = [
|
|
669
|
+
rect.x + (endX ?? rect.width / 2),
|
|
670
|
+
rect.y + (endY ?? rect.height / 2)
|
|
671
|
+
];
|
|
595
672
|
}
|
|
596
673
|
else {
|
|
597
674
|
if (endX == null || endY == null) {
|
|
@@ -632,34 +709,30 @@ async function windowsGetDeviceTime(args) {
|
|
|
632
709
|
return this.getDeviceTime(undefined, args?.format);
|
|
633
710
|
}
|
|
634
711
|
async function getWindowElement() {
|
|
635
|
-
const
|
|
712
|
+
const result = await this.sendPowerShellCommand(powershell_1.AutomationElement.automationRoot.buildCommand());
|
|
713
|
+
const elementId = result.split('\n').map((id) => id.trim()).filter(Boolean)[0];
|
|
636
714
|
if (!elementId) {
|
|
637
715
|
throw new base_driver_1.errors.NoSuchWindowError('No active app window is found for this session.');
|
|
638
716
|
}
|
|
639
717
|
return { [base_driver_1.W3C_ELEMENT_KEY]: elementId };
|
|
640
718
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
if (!remotePath) {
|
|
656
|
-
throw new base_driver_1.errors.InvalidArgumentError("'remotePath' must be provided.");
|
|
657
|
-
}
|
|
658
|
-
const data = await (0, promises_1.readFile)(remotePath);
|
|
659
|
-
return data.toString('base64');
|
|
660
|
-
}
|
|
719
|
+
const GET_MONITORS_COMMAND = (0, powershell_1.pwsh /* ps1 */) `
|
|
720
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
721
|
+
$index = 0
|
|
722
|
+
$monitors = @([System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
|
|
723
|
+
[PSCustomObject]@{
|
|
724
|
+
index = $index++
|
|
725
|
+
deviceName = $_.DeviceName
|
|
726
|
+
primary = $_.Primary
|
|
727
|
+
bounds = @{ x = $_.Bounds.X; y = $_.Bounds.Y; width = $_.Bounds.Width; height = $_.Bounds.Height }
|
|
728
|
+
workingArea = @{ x = $_.WorkingArea.X; y = $_.WorkingArea.Y; width = $_.WorkingArea.Width; height = $_.WorkingArea.Height }
|
|
729
|
+
}
|
|
730
|
+
})
|
|
731
|
+
ConvertTo-Json -InputObject $monitors -Compress
|
|
732
|
+
`;
|
|
661
733
|
async function windowsGetMonitors() {
|
|
662
|
-
|
|
734
|
+
const result = await this.sendPowerShellCommand(GET_MONITORS_COMMAND);
|
|
735
|
+
return JSON.parse(result.trim());
|
|
663
736
|
}
|
|
664
737
|
function executeGetDpiScale() {
|
|
665
738
|
return (0, user32_1.getResolutionScalingFactor)();
|