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
|
@@ -4,7 +4,7 @@ exports.ScreenRecorder = exports.DEFAULT_EXT = void 0;
|
|
|
4
4
|
exports.uploadRecordedMedia = uploadRecordedMedia;
|
|
5
5
|
const support_1 = require("appium/support");
|
|
6
6
|
const asyncbox_1 = require("asyncbox");
|
|
7
|
-
const
|
|
7
|
+
const teen_process_1 = require("teen_process");
|
|
8
8
|
const util_1 = require("../util");
|
|
9
9
|
const RETRY_PAUSE = 300;
|
|
10
10
|
const RETRY_TIMEOUT = 5000;
|
|
@@ -13,12 +13,12 @@ const PROCESS_SHUTDOWN_TIMEOUT = 10 * 1000;
|
|
|
13
13
|
exports.DEFAULT_EXT = 'mp4';
|
|
14
14
|
const DEFAULT_FPS = 15;
|
|
15
15
|
const DEFAULT_PRESET = 'veryfast';
|
|
16
|
-
async function requireFfmpegPath(
|
|
17
|
-
const bundled =
|
|
16
|
+
async function requireFfmpegPath() {
|
|
17
|
+
const bundled = (0, util_1.getBundledFfmpegPath)();
|
|
18
18
|
if (bundled) {
|
|
19
19
|
return bundled;
|
|
20
20
|
}
|
|
21
|
-
const ffmpegBinary =
|
|
21
|
+
const ffmpegBinary = `ffmpeg${support_1.system.isWindows() ? '.exe' : ''}`;
|
|
22
22
|
try {
|
|
23
23
|
return await support_1.fs.which(ffmpegBinary);
|
|
24
24
|
}
|
|
@@ -45,7 +45,7 @@ async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
|
|
|
45
45
|
return '';
|
|
46
46
|
}
|
|
47
47
|
class ScreenRecorder {
|
|
48
|
-
|
|
48
|
+
log;
|
|
49
49
|
_videoPath;
|
|
50
50
|
_process = null;
|
|
51
51
|
_fps;
|
|
@@ -55,8 +55,8 @@ class ScreenRecorder {
|
|
|
55
55
|
_preset;
|
|
56
56
|
_videoFilter;
|
|
57
57
|
_timeLimit;
|
|
58
|
-
constructor(videoPath,
|
|
59
|
-
this.
|
|
58
|
+
constructor(videoPath, log, opts = {}) {
|
|
59
|
+
this.log = log;
|
|
60
60
|
this._videoPath = videoPath;
|
|
61
61
|
this._fps = opts.fps && opts.fps > 0 ? opts.fps : DEFAULT_FPS;
|
|
62
62
|
this._audioInput = opts.audioInput;
|
|
@@ -77,13 +77,13 @@ class ScreenRecorder {
|
|
|
77
77
|
return this._videoPath;
|
|
78
78
|
}
|
|
79
79
|
isRunning() {
|
|
80
|
-
return !!this._process
|
|
80
|
+
return !!this._process?.isRunning;
|
|
81
81
|
}
|
|
82
82
|
async _enforceTermination() {
|
|
83
83
|
if (this._process && this.isRunning()) {
|
|
84
|
-
this.
|
|
84
|
+
this.log.debug('Force-stopping the currently running video recording');
|
|
85
85
|
try {
|
|
86
|
-
this._process.
|
|
86
|
+
await this._process.stop('SIGKILL');
|
|
87
87
|
}
|
|
88
88
|
catch { }
|
|
89
89
|
}
|
|
@@ -95,7 +95,7 @@ class ScreenRecorder {
|
|
|
95
95
|
return '';
|
|
96
96
|
}
|
|
97
97
|
async start() {
|
|
98
|
-
const ffmpegPath = await requireFfmpegPath(
|
|
98
|
+
const ffmpegPath = await requireFfmpegPath();
|
|
99
99
|
const args = [
|
|
100
100
|
'-loglevel', 'error',
|
|
101
101
|
'-t', String(this._timeLimit),
|
|
@@ -115,34 +115,25 @@ class ScreenRecorder {
|
|
|
115
115
|
...(this._videoFilter ? ['-filter:v', this._videoFilter] : []),
|
|
116
116
|
this._videoPath,
|
|
117
117
|
];
|
|
118
|
-
this._process =
|
|
119
|
-
this.
|
|
120
|
-
this._process.
|
|
121
|
-
const out =
|
|
122
|
-
if (out
|
|
123
|
-
this.
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
this._process.stderr.on('data', (data) => {
|
|
127
|
-
const out = data.toString();
|
|
128
|
-
if (out.trim()) {
|
|
129
|
-
this._driver.log.debug(`[ffmpeg] ${out.trim()}`);
|
|
118
|
+
this._process = new teen_process_1.SubProcess(ffmpegPath, args, { windowsHide: true });
|
|
119
|
+
this.log.debug(`Starting ffmpeg: ${support_1.util.quote([ffmpegPath, ...args])}`);
|
|
120
|
+
this._process.on('output', (stdout, stderr) => {
|
|
121
|
+
const out = stdout || stderr;
|
|
122
|
+
if (out?.trim()) {
|
|
123
|
+
this.log.debug(`[ffmpeg] ${out}`);
|
|
130
124
|
}
|
|
131
125
|
});
|
|
132
126
|
this._process.once('exit', async (code, signal) => {
|
|
133
127
|
this._process = null;
|
|
134
128
|
if (code === 0) {
|
|
135
|
-
this.
|
|
129
|
+
this.log.debug('Screen recording exited without errors');
|
|
136
130
|
}
|
|
137
131
|
else {
|
|
138
132
|
await this._enforceTermination();
|
|
139
|
-
this.
|
|
133
|
+
this.log.warn(`Screen recording exited with error code ${code}, signal ${signal}`);
|
|
140
134
|
}
|
|
141
135
|
});
|
|
142
|
-
await
|
|
143
|
-
this._process?.once('error', reject);
|
|
144
|
-
setTimeout(resolve, 50);
|
|
145
|
-
});
|
|
136
|
+
await this._process.start(0);
|
|
146
137
|
try {
|
|
147
138
|
await (0, asyncbox_1.waitForCondition)(async () => {
|
|
148
139
|
if (await this.getVideoPath()) {
|
|
@@ -159,14 +150,14 @@ class ScreenRecorder {
|
|
|
159
150
|
throw new Error(`The expected screen record file '${this._videoPath}' does not exist. ` +
|
|
160
151
|
'Check the server log for more details');
|
|
161
152
|
}
|
|
162
|
-
this.
|
|
153
|
+
this.log.info(`The video recording has started. Will timeout in ${support_1.util.pluralize('second', this._timeLimit, true)}`);
|
|
163
154
|
}
|
|
164
155
|
async stop(force = false) {
|
|
165
156
|
if (force) {
|
|
166
157
|
return await this._enforceTermination();
|
|
167
158
|
}
|
|
168
159
|
if (!this.isRunning()) {
|
|
169
|
-
this.
|
|
160
|
+
this.log.debug('Screen recording is not running. Returning the recent result');
|
|
170
161
|
return await this.getVideoPath();
|
|
171
162
|
}
|
|
172
163
|
return new Promise((resolve, reject) => {
|
|
@@ -183,8 +174,8 @@ class ScreenRecorder {
|
|
|
183
174
|
reject(new Error(`Screen recording exited with error code ${code}, signal ${signal}`));
|
|
184
175
|
}
|
|
185
176
|
});
|
|
186
|
-
this._process?.stdin?.write('q');
|
|
187
|
-
this._process?.stdin?.end();
|
|
177
|
+
this._process?.proc?.stdin?.write('q');
|
|
178
|
+
this._process?.proc?.stdin?.end();
|
|
188
179
|
});
|
|
189
180
|
}
|
|
190
181
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-recorder.js","sourceRoot":"","sources":["../../../lib/commands/screen-recorder.ts"],"names":[],"mappings":";;;AAkDA,kDAoBC;
|
|
1
|
+
{"version":3,"file":"screen-recorder.js","sourceRoot":"","sources":["../../../lib/commands/screen-recorder.ts"],"names":[],"mappings":";;;AAkDA,kDAoBC;AArED,4CAAuD;AACvD,uCAA4C;AAC5C,+CAA0C;AAC1C,kCAA+C;AAE/C,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,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
@@ -34,44 +34,25 @@ export declare const UI_AUTOMATION_DRIVER_CONSTRAINTS: {
|
|
|
34
34
|
readonly isolatedScriptExecution: {
|
|
35
35
|
readonly isBoolean: true;
|
|
36
36
|
};
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
};
|
|
40
|
-
readonly systemPort: {
|
|
41
|
-
readonly isNumber: true;
|
|
37
|
+
readonly appEnvironment: {
|
|
38
|
+
readonly isObject: true;
|
|
42
39
|
};
|
|
43
40
|
readonly 'ms:waitForAppLaunch': {
|
|
44
41
|
readonly isNumber: true;
|
|
45
42
|
};
|
|
46
|
-
readonly 'ms:experimental-webdriver': {
|
|
47
|
-
readonly isBoolean: true;
|
|
48
|
-
};
|
|
49
43
|
readonly 'ms:forcequit': {
|
|
50
44
|
readonly isBoolean: true;
|
|
51
45
|
};
|
|
52
|
-
readonly
|
|
53
|
-
readonly webviewEnabled: {
|
|
46
|
+
readonly returnAllWindowHandles: {
|
|
54
47
|
readonly isBoolean: true;
|
|
55
48
|
};
|
|
56
|
-
readonly
|
|
49
|
+
readonly 'ms:windowSwitchRetries': {
|
|
57
50
|
readonly isNumber: true;
|
|
58
51
|
};
|
|
59
|
-
readonly
|
|
60
|
-
readonly
|
|
61
|
-
};
|
|
62
|
-
readonly edgedriverCdnUrl: {
|
|
63
|
-
readonly isString: true;
|
|
64
|
-
};
|
|
65
|
-
readonly chromedriverExecutablePath: {
|
|
66
|
-
readonly isString: true;
|
|
67
|
-
};
|
|
68
|
-
readonly edgedriverExecutablePath: {
|
|
69
|
-
readonly isString: true;
|
|
70
|
-
};
|
|
71
|
-
readonly ffmpegExecutablePath: {
|
|
72
|
-
readonly isString: true;
|
|
52
|
+
readonly 'ms:windowSwitchInterval': {
|
|
53
|
+
readonly isNumber: true;
|
|
73
54
|
};
|
|
74
55
|
};
|
|
75
56
|
export default UI_AUTOMATION_DRIVER_CONSTRAINTS;
|
|
76
|
-
export type
|
|
57
|
+
export type AppiumDesktopDriverConstraints = typeof UI_AUTOMATION_DRIVER_CONSTRAINTS;
|
|
77
58
|
//# sourceMappingURL=constraints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../lib/constraints.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC
|
|
1
|
+
{"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../lib/constraints.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDb,CAAC;AAEjC,eAAe,gCAAgC,CAAC;AAEhD,MAAM,MAAM,8BAA8B,GAAG,OAAO,gCAAgC,CAAC"}
|
package/build/lib/constraints.js
CHANGED
|
@@ -37,42 +37,23 @@ exports.UI_AUTOMATION_DRIVER_CONSTRAINTS = {
|
|
|
37
37
|
isolatedScriptExecution: {
|
|
38
38
|
isBoolean: true,
|
|
39
39
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
systemPort: {
|
|
44
|
-
isNumber: true,
|
|
40
|
+
appEnvironment: {
|
|
41
|
+
isObject: true,
|
|
45
42
|
},
|
|
46
43
|
'ms:waitForAppLaunch': {
|
|
47
44
|
isNumber: true,
|
|
48
45
|
},
|
|
49
|
-
'ms:experimental-webdriver': {
|
|
50
|
-
isBoolean: true,
|
|
51
|
-
},
|
|
52
46
|
'ms:forcequit': {
|
|
53
47
|
isBoolean: true,
|
|
54
48
|
},
|
|
55
|
-
|
|
56
|
-
webviewEnabled: {
|
|
49
|
+
returnAllWindowHandles: {
|
|
57
50
|
isBoolean: true,
|
|
58
51
|
},
|
|
59
|
-
|
|
52
|
+
'ms:windowSwitchRetries': {
|
|
60
53
|
isNumber: true,
|
|
61
54
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
edgedriverCdnUrl: {
|
|
66
|
-
isString: true,
|
|
67
|
-
},
|
|
68
|
-
chromedriverExecutablePath: {
|
|
69
|
-
isString: true,
|
|
70
|
-
},
|
|
71
|
-
edgedriverExecutablePath: {
|
|
72
|
-
isString: true,
|
|
73
|
-
},
|
|
74
|
-
ffmpegExecutablePath: {
|
|
75
|
-
isString: true,
|
|
55
|
+
'ms:windowSwitchInterval': {
|
|
56
|
+
isNumber: true,
|
|
76
57
|
},
|
|
77
58
|
};
|
|
78
59
|
exports.default = exports.UI_AUTOMATION_DRIVER_CONSTRAINTS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraints.js","sourceRoot":"","sources":["../../lib/constraints.ts"],"names":[],"mappings":";;;AAEa,QAAA,gCAAgC,GAAG;IAC5C,YAAY,EAAE;QACV,QAAQ,EAAE,IAAI;QACd,wBAAwB,EAAE,CAAC,SAAS,CAAC;QACrC,QAAQ,EAAE,IAAI;KACjB;IACD,iBAAiB,EAAE;QACf,QAAQ,EAAE,IAAI;KACjB;IACD,gBAAgB,EAAE;QACd,QAAQ,EAAE,IAAI;KACjB;IACD,eAAe,EAAE;QACb,QAAQ,EAAE,IAAI;KACjB;IACD,iBAAiB,EAAE;QACf,QAAQ,EAAE,IAAI;KACjB;IACD,cAAc,EAAE;QACZ,SAAS,EAAE,IAAI;KAClB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,IAAI;KACjB;IACD,aAAa,EAAE;QACX,QAAQ,EAAE,IAAI;KACjB;IACD,MAAM,EAAE;QACJ,QAAQ,EAAE,IAAI;KACjB;IACD,OAAO,EAAE;QACL,QAAQ,EAAE,IAAI;KACjB;IACD,uBAAuB,EAAE;QACrB,SAAS,EAAE,IAAI;KAClB;IACD,
|
|
1
|
+
{"version":3,"file":"constraints.js","sourceRoot":"","sources":["../../lib/constraints.ts"],"names":[],"mappings":";;;AAEa,QAAA,gCAAgC,GAAG;IAC5C,YAAY,EAAE;QACV,QAAQ,EAAE,IAAI;QACd,wBAAwB,EAAE,CAAC,SAAS,CAAC;QACrC,QAAQ,EAAE,IAAI;KACjB;IACD,iBAAiB,EAAE;QACf,QAAQ,EAAE,IAAI;KACjB;IACD,gBAAgB,EAAE;QACd,QAAQ,EAAE,IAAI;KACjB;IACD,eAAe,EAAE;QACb,QAAQ,EAAE,IAAI;KACjB;IACD,iBAAiB,EAAE;QACf,QAAQ,EAAE,IAAI;KACjB;IACD,cAAc,EAAE;QACZ,SAAS,EAAE,IAAI;KAClB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,IAAI;KACjB;IACD,aAAa,EAAE;QACX,QAAQ,EAAE,IAAI;KACjB;IACD,MAAM,EAAE;QACJ,QAAQ,EAAE,IAAI;KACjB;IACD,OAAO,EAAE;QACL,QAAQ,EAAE,IAAI;KACjB;IACD,uBAAuB,EAAE;QACrB,SAAS,EAAE,IAAI;KAClB;IACD,cAAc,EAAE;QACZ,QAAQ,EAAE,IAAI;KACjB;IACD,qBAAqB,EAAE;QACnB,QAAQ,EAAE,IAAI;KACjB;IACD,cAAc,EAAE;QACZ,SAAS,EAAE,IAAI;KAClB;IACD,sBAAsB,EAAE;QACpB,SAAS,EAAE,IAAI;KAClB;IACD,wBAAwB,EAAE;QACtB,QAAQ,EAAE,IAAI;KACjB;IACD,yBAAyB,EAAE;QACvB,QAAQ,EAAE,IAAI;KACjB;CAC2B,CAAC;AAEjC,kBAAe,wCAAgC,CAAC"}
|
package/build/lib/driver.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { BaseDriver } from '@appium/base-driver';
|
|
2
|
+
import { ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
2
3
|
import type { ScreenRecorder } from './commands/screen-recorder';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import type { DefaultCreateSessionResult, DriverData, Element, ExternalDriver, InitialOpts, RouteMatcher, StringRecord, W3CDriverCaps } from '@appium/types';
|
|
8
|
-
type W3CNovaWindowsDriverCaps = W3CDriverCaps<NovaWindowsDriverConstraints>;
|
|
9
|
-
type DefaultWindowsCreateSessionResult = DefaultCreateSessionResult<NovaWindowsDriverConstraints>;
|
|
4
|
+
import { AppiumDesktopDriverConstraints } from './constraints';
|
|
5
|
+
import type { DefaultCreateSessionResult, DriverData, Element, InitialOpts, StringRecord, W3CDriverCaps } from '@appium/types';
|
|
6
|
+
type W3CAppiumDesktopDriverCaps = W3CDriverCaps<AppiumDesktopDriverConstraints>;
|
|
7
|
+
type DefaultWindowsCreateSessionResult = DefaultCreateSessionResult<AppiumDesktopDriverConstraints>;
|
|
10
8
|
type KeyboardState = {
|
|
11
9
|
pressed: Set<string>;
|
|
12
10
|
shift: boolean;
|
|
@@ -15,30 +13,23 @@ type KeyboardState = {
|
|
|
15
13
|
alt: boolean;
|
|
16
14
|
};
|
|
17
15
|
declare const LOCATION_STRATEGIES: readonly ["id", "name", "xpath", "tag name", "class name", "accessibility id", "-windows uiautomation"];
|
|
18
|
-
export declare class AppiumDesktopDriver extends BaseDriver<
|
|
19
|
-
|
|
16
|
+
export declare class AppiumDesktopDriver extends BaseDriver<AppiumDesktopDriverConstraints, StringRecord> {
|
|
17
|
+
isPowerShellSessionStarted: boolean;
|
|
18
|
+
powerShell?: ChildProcessWithoutNullStreams;
|
|
19
|
+
powerShellStdOut: string;
|
|
20
|
+
powerShellStdErr: string;
|
|
21
|
+
appProcessIds: number[];
|
|
20
22
|
keyboardState: KeyboardState;
|
|
21
|
-
|
|
22
|
-
proxyReqRes: ((...args: any) => any) | null;
|
|
23
|
-
proxyCommand: ExternalDriver['proxyCommand'] | null;
|
|
24
|
-
contexts: string[];
|
|
25
|
-
jwpProxyActive: boolean;
|
|
26
|
-
currentContext: string | null;
|
|
23
|
+
mouseButtonsDown: Set<number>;
|
|
27
24
|
_screenRecorder: ScreenRecorder | null;
|
|
28
|
-
_logFileMirror: LogFileMirror | null;
|
|
29
|
-
webviewDevtoolsPort: number | null;
|
|
30
25
|
constructor(opts?: InitialOpts, shouldValidateCaps?: boolean);
|
|
31
|
-
sendCommand(method: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
32
|
-
canProxy(): boolean;
|
|
33
|
-
proxyActive(): boolean;
|
|
34
|
-
getProxyAvoidList(): RouteMatcher[];
|
|
35
26
|
findElement(strategy: string, selector: string): Promise<Element>;
|
|
36
27
|
findElements(strategy: string, selector: string): Promise<Element[]>;
|
|
37
28
|
findElementFromElement(strategy: string, selector: string, elementId: string): Promise<Element>;
|
|
38
29
|
findElementsFromElement(strategy: string, selector: string, elementId: string): Promise<Element[]>;
|
|
39
30
|
findElOrEls(strategy: typeof LOCATION_STRATEGIES[number], selector: string, mult: true, context?: string): Promise<Element[]>;
|
|
40
31
|
findElOrEls(strategy: typeof LOCATION_STRATEGIES[number], selector: string, mult: false, context?: string): Promise<Element>;
|
|
41
|
-
createSession(jwpCaps:
|
|
32
|
+
createSession(jwpCaps: W3CAppiumDesktopDriverCaps, reqCaps?: W3CAppiumDesktopDriverCaps, w3cCaps?: W3CAppiumDesktopDriverCaps, driverData?: DriverData[]): Promise<DefaultWindowsCreateSessionResult>;
|
|
42
33
|
deleteSession(sessionId?: string | null | undefined): Promise<void>;
|
|
43
34
|
private processSelector;
|
|
44
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,qBAAqB,CAAC;AAE1E,OAAO,
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../lib/driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EACH,8BAA8B,EAEjC,MAAM,eAAe,CAAC;AAoBvB,OAAO,KAAK,EACR,0BA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AQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAKlG,WAAW,CAAC,QAAQ,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7H,WAAW,CAAC,QAAQ,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA8C5H,aAAa,CACxB,OAAO,EAAE,0BAA0B,EACnC,OAAO,CAAC,EAAE,0BAA0B,EACpC,OAAO,CAAC,EAAE,0BAA0B,EACpC,UAAU,CAAC,EAAE,UAAU,EAAE,GAC1B,OAAO,CAAC,iCAAiC,CAAC;IA0D9B,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAiClF,OAAO,CAAC,eAAe;CA4B1B"}
|
package/build/lib/driver.js
CHANGED
|
@@ -8,11 +8,7 @@ const base_driver_1 = require("@appium/base-driver");
|
|
|
8
8
|
const support_1 = require("appium/support");
|
|
9
9
|
const commands_1 = __importDefault(require("./commands"));
|
|
10
10
|
const constraints_1 = require("./constraints");
|
|
11
|
-
const
|
|
12
|
-
const converter_bridge_1 = require("./server/converter-bridge");
|
|
13
|
-
const conditions_1 = require("./server/conditions");
|
|
14
|
-
const log_file_1 = require("./log-file");
|
|
15
|
-
const version_1 = require("./version");
|
|
11
|
+
const powershell_1 = require("./powershell");
|
|
16
12
|
const util_1 = require("./util");
|
|
17
13
|
const user32_1 = require("./winapi/user32");
|
|
18
14
|
const xpath_1 = require("./xpath");
|
|
@@ -25,29 +21,12 @@ const LOCATION_STRATEGIES = Object.freeze([
|
|
|
25
21
|
'accessibility id',
|
|
26
22
|
'-windows uiautomation',
|
|
27
23
|
]);
|
|
28
|
-
// This is a set of methods and paths that we never want to proxy to Chromedriver.
|
|
29
|
-
const CHROMEDRIVER_NO_PROXY = [
|
|
30
|
-
['GET', new RegExp('^/session/[^/]+/appium')],
|
|
31
|
-
['GET', new RegExp('^/session/[^/]+/context')],
|
|
32
|
-
['GET', new RegExp('^/session/[^/]+/element/[^/]+/rect')],
|
|
33
|
-
['GET', new RegExp('^/session/[^/]+/orientation')],
|
|
34
|
-
['POST', new RegExp('^/session/[^/]+/appium')],
|
|
35
|
-
['POST', new RegExp('^/session/[^/]+/context')],
|
|
36
|
-
['POST', new RegExp('^/session/[^/]+/orientation')],
|
|
37
|
-
// this is needed to make the windows: and powerShell commands work in web context
|
|
38
|
-
['POST', new RegExp('^/session/[^/]+/execute$')],
|
|
39
|
-
['POST', new RegExp('^/session/[^/]+/execute/sync')],
|
|
40
|
-
// MJSONWP commands
|
|
41
|
-
['GET', new RegExp('^/session/[^/]+/log/types$')],
|
|
42
|
-
['POST', new RegExp('^/session/[^/]+/log$')],
|
|
43
|
-
// W3C commands
|
|
44
|
-
// For Selenium v4 (W3C does not have this route)
|
|
45
|
-
['GET', new RegExp('^/session/[^/]+/se/log/types$')],
|
|
46
|
-
// For Selenium v4 (W3C does not have this route)
|
|
47
|
-
['POST', new RegExp('^/session/[^/]+/se/log$')],
|
|
48
|
-
];
|
|
49
24
|
class AppiumDesktopDriver extends base_driver_1.BaseDriver {
|
|
50
|
-
|
|
25
|
+
isPowerShellSessionStarted = false;
|
|
26
|
+
powerShell;
|
|
27
|
+
powerShellStdOut = '';
|
|
28
|
+
powerShellStdErr = '';
|
|
29
|
+
appProcessIds = [];
|
|
51
30
|
keyboardState = {
|
|
52
31
|
pressed: new Set(),
|
|
53
32
|
alt: false,
|
|
@@ -55,40 +34,18 @@ class AppiumDesktopDriver extends base_driver_1.BaseDriver {
|
|
|
55
34
|
meta: false,
|
|
56
35
|
shift: false,
|
|
57
36
|
};
|
|
58
|
-
|
|
59
|
-
proxyReqRes = null;
|
|
60
|
-
proxyCommand = null;
|
|
61
|
-
contexts = [];
|
|
62
|
-
jwpProxyActive = false;
|
|
63
|
-
currentContext = null;
|
|
37
|
+
mouseButtonsDown = new Set();
|
|
64
38
|
_screenRecorder = null;
|
|
65
|
-
_logFileMirror = null;
|
|
66
|
-
webviewDevtoolsPort = null;
|
|
67
39
|
constructor(opts = {}, shouldValidateCaps = true) {
|
|
68
40
|
super(opts, shouldValidateCaps);
|
|
69
41
|
this.locatorStrategies = [...LOCATION_STRATEGIES];
|
|
70
42
|
this.desiredCapConstraints = constraints_1.UI_AUTOMATION_DRIVER_CONSTRAINTS;
|
|
71
43
|
// Bind commands to this instance (not prototype) so each driver instance uses its own
|
|
72
|
-
//
|
|
44
|
+
// PowerShell session and state when multiple sessions exist
|
|
73
45
|
for (const key in commands_1.default) { // TODO: create a decorator that will do that for the class
|
|
74
46
|
this[key] = commands_1.default[key].bind(this);
|
|
75
47
|
}
|
|
76
48
|
}
|
|
77
|
-
async sendCommand(method, params = {}) {
|
|
78
|
-
if (!this.serverClient) {
|
|
79
|
-
throw new base_driver_1.errors.UnknownError('NovaUIAutomationServer is not running.');
|
|
80
|
-
}
|
|
81
|
-
return await this.serverClient.sendCommand(method, params);
|
|
82
|
-
}
|
|
83
|
-
canProxy() {
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
proxyActive() {
|
|
87
|
-
return this.jwpProxyActive;
|
|
88
|
-
}
|
|
89
|
-
getProxyAvoidList() {
|
|
90
|
-
return this.jwpProxyActive && this.chromedriver ? CHROMEDRIVER_NO_PROXY : [];
|
|
91
|
-
}
|
|
92
49
|
async findElement(strategy, selector) {
|
|
93
50
|
[strategy, selector] = this.processSelector(strategy, selector);
|
|
94
51
|
return super.findElement(strategy, selector);
|
|
@@ -109,47 +66,40 @@ class AppiumDesktopDriver extends base_driver_1.BaseDriver {
|
|
|
109
66
|
let condition;
|
|
110
67
|
switch (strategy) {
|
|
111
68
|
case 'id':
|
|
112
|
-
condition = (
|
|
69
|
+
condition = new powershell_1.PropertyCondition(powershell_1.Property.RUNTIME_ID, new powershell_1.PSInt32Array(selector.split('.').map(Number)));
|
|
113
70
|
break;
|
|
114
71
|
case 'tag name':
|
|
115
|
-
|
|
116
|
-
// Nova historically matches ControlType (PascalCase: "Button", "Edit").
|
|
117
|
-
// Detect which style the selector uses to support both transparently.
|
|
118
|
-
condition = selector === selector.toLowerCase()
|
|
119
|
-
? (0, conditions_1.propertyCondition)('LocalizedControlType', selector)
|
|
120
|
-
: (0, conditions_1.propertyCondition)('ControlType', selector);
|
|
72
|
+
condition = new powershell_1.PropertyCondition(powershell_1.Property.CONTROL_TYPE, new powershell_1.PSControlType(selector));
|
|
121
73
|
break;
|
|
122
74
|
case 'accessibility id':
|
|
123
|
-
condition = (
|
|
75
|
+
condition = new powershell_1.PropertyCondition(powershell_1.Property.AUTOMATION_ID, new powershell_1.PSString(selector));
|
|
124
76
|
break;
|
|
125
77
|
case 'name':
|
|
126
|
-
condition = (
|
|
78
|
+
condition = new powershell_1.PropertyCondition(powershell_1.Property.NAME, new powershell_1.PSString(selector));
|
|
127
79
|
break;
|
|
128
80
|
case 'class name':
|
|
129
|
-
condition = (
|
|
81
|
+
condition = new powershell_1.PropertyCondition(powershell_1.Property.CLASS_NAME, new powershell_1.PSString(selector));
|
|
130
82
|
break;
|
|
131
83
|
case '-windows uiautomation':
|
|
132
|
-
condition = (0,
|
|
84
|
+
condition = (0, powershell_1.convertStringToCondition)(selector);
|
|
133
85
|
break;
|
|
134
86
|
case 'xpath':
|
|
135
|
-
return await (0, xpath_1.xpathToElIdOrIds)(selector, mult, context, this.
|
|
87
|
+
return await (0, xpath_1.xpathToElIdOrIds)(selector, mult, context, this.sendPowerShellCommand.bind(this));
|
|
136
88
|
default:
|
|
137
89
|
throw new base_driver_1.errors.InvalidArgumentError(`Invalid find strategy ${strategy}`);
|
|
138
90
|
}
|
|
139
|
-
const
|
|
140
|
-
scope: 'descendants',
|
|
141
|
-
condition,
|
|
142
|
-
contextElementId: context ?? null,
|
|
143
|
-
};
|
|
91
|
+
const searchContext = context ? new powershell_1.FoundAutomationElement(context) : powershell_1.AutomationElement.automationRoot;
|
|
144
92
|
if (mult) {
|
|
145
|
-
const result = await this.
|
|
146
|
-
|
|
93
|
+
const result = await this.sendPowerShellCommand(searchContext.findAll(powershell_1.TreeScope.DESCENDANTS, condition).buildCommand());
|
|
94
|
+
const elIds = result.split('\n').map((elId) => elId.trim()).filter(Boolean);
|
|
95
|
+
return elIds.filter(Boolean).map((elId) => ({ [base_driver_1.W3C_ELEMENT_KEY]: elId }));
|
|
147
96
|
}
|
|
148
|
-
const result = await this.
|
|
149
|
-
|
|
97
|
+
const result = await this.sendPowerShellCommand(searchContext.findFirst(powershell_1.TreeScope.DESCENDANTS, condition).buildCommand());
|
|
98
|
+
const elId = result.trim();
|
|
99
|
+
if (!elId) {
|
|
150
100
|
throw new base_driver_1.errors.NoSuchElementError();
|
|
151
101
|
}
|
|
152
|
-
return { [base_driver_1.W3C_ELEMENT_KEY]:
|
|
102
|
+
return { [base_driver_1.W3C_ELEMENT_KEY]: elId };
|
|
153
103
|
}
|
|
154
104
|
async createSession(jwpCaps, reqCaps, w3cCaps, driverData) {
|
|
155
105
|
if (!support_1.system.isWindows()) {
|
|
@@ -161,47 +111,33 @@ class AppiumDesktopDriver extends base_driver_1.BaseDriver {
|
|
|
161
111
|
if (typeof w3cCaps?.firstMatch?.some['appium:appTopLevelWindow'] === 'number') {
|
|
162
112
|
w3cCaps.firstMatch['appium:appTopLevelWindow'] = w3cCaps.firstMatch['appium:appTopLevelWindow'].map(String);
|
|
163
113
|
}
|
|
164
|
-
// Warn when the same logical capability is sent under both prefixed and unprefixed keys with different values
|
|
165
|
-
if (w3cCaps?.alwaysMatch) {
|
|
166
|
-
const am = w3cCaps.alwaysMatch;
|
|
167
|
-
for (const cap of ['app', 'appArguments', 'appWorkingDir', 'appTopLevelWindow']) {
|
|
168
|
-
const unprefixed = am[cap];
|
|
169
|
-
const prefixed = am[`appium:${cap}`];
|
|
170
|
-
if (unprefixed !== undefined && prefixed !== undefined && unprefixed !== prefixed) {
|
|
171
|
-
this.log.warn(`Conflicting values for '${cap}': unprefixed='${unprefixed}', appium:${cap}='${prefixed}'. The appium:-prefixed value takes precedence.`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
114
|
try {
|
|
176
115
|
this.log.debug('Creating AppiumDesktop driver session...');
|
|
177
116
|
const [sessionId, caps] = await super.createSession(jwpCaps, reqCaps, w3cCaps, driverData);
|
|
178
|
-
if (caps.logFile !== undefined && caps.logFile !== false) {
|
|
179
|
-
try {
|
|
180
|
-
this._logFileMirror = (0, log_file_1.attachLogFileMirror)(this.log, caps.logFile);
|
|
181
|
-
this.log.info(`Driver log is being mirrored to ${this._logFileMirror.path}`);
|
|
182
|
-
}
|
|
183
|
-
catch (e) {
|
|
184
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
185
|
-
this.log.warn(`Failed to attach log file mirror: ${msg}`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
// Stamp the driver version in the log so we can tell which build is
|
|
189
|
-
// running — useful when testing across rebuilds. The C# server
|
|
190
|
-
// prints its own version banner shortly after via stderr → log.
|
|
191
|
-
this.log.info(`appium-desktop-driver v${version_1.DRIVER_VERSION} (session ${sessionId})`);
|
|
192
117
|
if (caps.smoothPointerMove) {
|
|
193
118
|
(0, util_1.assertSupportedEasingFunction)(caps.smoothPointerMove);
|
|
194
119
|
}
|
|
195
120
|
if (caps.app && caps.appTopLevelWindow) {
|
|
196
121
|
throw new base_driver_1.errors.InvalidArgumentError('Invalid capabilities. Specify either app or appTopLevelWindow.');
|
|
197
122
|
}
|
|
123
|
+
if (caps.appEnvironment) {
|
|
124
|
+
const invalidKeys = Object.entries(caps.appEnvironment)
|
|
125
|
+
.filter(([, v]) => typeof v !== 'string')
|
|
126
|
+
.map(([k]) => k);
|
|
127
|
+
if (invalidKeys.length > 0) {
|
|
128
|
+
throw new base_driver_1.errors.InvalidArgumentError(`Invalid capabilities. 'appEnvironment' values must be strings. Invalid keys: ${invalidKeys.join(', ')}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (caps['ms:windowSwitchRetries'] !== undefined) {
|
|
132
|
+
(0, util_1.assertIntegerCap)('ms:windowSwitchRetries', caps['ms:windowSwitchRetries'], 0);
|
|
133
|
+
}
|
|
134
|
+
if (caps['ms:windowSwitchInterval'] !== undefined) {
|
|
135
|
+
(0, util_1.assertIntegerCap)('ms:windowSwitchInterval', caps['ms:windowSwitchInterval'], 0);
|
|
136
|
+
}
|
|
198
137
|
if (this.caps.shouldCloseApp === undefined) {
|
|
199
138
|
this.caps.shouldCloseApp = true; // set default value
|
|
200
139
|
}
|
|
201
|
-
|
|
202
|
-
this.log.info(`systemPort capability (${this.caps.systemPort}) is ignored. NovaWindows uses stdin/stdout IPC.`);
|
|
203
|
-
}
|
|
204
|
-
await this.startServerSession();
|
|
140
|
+
await this.startPowerShellSession();
|
|
205
141
|
if (this.caps.prerun) {
|
|
206
142
|
this.log.info('Executing prerun PowerShell script...');
|
|
207
143
|
await this.executePowerShellScript(this.caps.prerun);
|
|
@@ -217,34 +153,21 @@ class AppiumDesktopDriver extends base_driver_1.BaseDriver {
|
|
|
217
153
|
}
|
|
218
154
|
async deleteSession(sessionId) {
|
|
219
155
|
this.log.debug('Deleting AppiumDesktop driver session...');
|
|
220
|
-
if (this.chromedriver) {
|
|
221
|
-
try {
|
|
222
|
-
await this.chromedriver.stop();
|
|
223
|
-
}
|
|
224
|
-
catch (e) {
|
|
225
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
226
|
-
this.log.warn(`Failed to stop chromedriver during session teardown: ${msg}`);
|
|
227
|
-
}
|
|
228
|
-
this.chromedriver = null;
|
|
229
|
-
this.jwpProxyActive = false;
|
|
230
|
-
this.proxyReqRes = null;
|
|
231
|
-
this.proxyCommand = null;
|
|
232
|
-
this.currentContext = null;
|
|
233
|
-
}
|
|
234
156
|
if (this.caps.shouldCloseApp && this.caps.app && this.caps.app.toLowerCase() !== 'root') {
|
|
235
157
|
try {
|
|
236
158
|
if (this.caps['ms:forcequit'] === true) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
159
|
+
await this.sendPowerShellCommand(/* ps1 */ `
|
|
160
|
+
if ($null -ne $rootElement) {
|
|
161
|
+
$processId = $rootElement.Current.ProcessId
|
|
162
|
+
Stop-Process -Id $processId -Force -ErrorAction SilentlyContinue
|
|
163
|
+
}
|
|
164
|
+
`);
|
|
243
165
|
}
|
|
244
166
|
else {
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
167
|
+
const result = await this.sendPowerShellCommand(powershell_1.AutomationElement.automationRoot.buildCommand());
|
|
168
|
+
const elementId = result.split('\n').map((id) => id.trim()).filter(Boolean)[0];
|
|
169
|
+
if (elementId) {
|
|
170
|
+
await this.sendPowerShellCommand(new powershell_1.FoundAutomationElement(elementId).buildCloseCommand());
|
|
248
171
|
}
|
|
249
172
|
}
|
|
250
173
|
}
|
|
@@ -257,12 +180,8 @@ class AppiumDesktopDriver extends base_driver_1.BaseDriver {
|
|
|
257
180
|
await this.executePowerShellScript(this.caps.postrun);
|
|
258
181
|
}
|
|
259
182
|
await this.releaseActions();
|
|
260
|
-
await this.
|
|
183
|
+
await this.terminatePowerShellSession();
|
|
261
184
|
await super.deleteSession(sessionId);
|
|
262
|
-
if (this._logFileMirror) {
|
|
263
|
-
this._logFileMirror.detach();
|
|
264
|
-
this._logFileMirror = null;
|
|
265
|
-
}
|
|
266
185
|
}
|
|
267
186
|
processSelector(strategy, selector) {
|
|
268
187
|
if (strategy !== 'css selector') {
|