@appium/fake-driver 5.1.3 → 5.1.4
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/build/lib/commands/alert.d.ts +58 -310
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +58 -69
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/contexts.d.ts +81 -330
- package/build/lib/commands/contexts.d.ts.map +1 -1
- package/build/lib/commands/contexts.js +75 -84
- package/build/lib/commands/contexts.js.map +1 -1
- package/build/lib/commands/element.d.ts +146 -315
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +134 -98
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/find.d.ts +83 -327
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +93 -97
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +174 -332
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +119 -90
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/index.d.ts +5 -1523
- package/build/lib/commands/index.d.ts.map +1 -1
- package/build/lib/commands/index.js +14 -14
- package/build/lib/commands/index.js.map +1 -1
- package/build/lib/driver.d.ts +80 -15
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +74 -24
- package/build/lib/driver.js.map +1 -1
- package/build/lib/types.d.ts +1 -24
- package/build/lib/types.d.ts.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/commands/alert.js +58 -67
- package/lib/commands/contexts.js +72 -81
- package/lib/commands/element.js +135 -94
- package/lib/commands/find.js +94 -98
- package/lib/commands/general.js +119 -91
- package/lib/commands/index.js +5 -13
- package/lib/driver.js +76 -20
- package/lib/types.ts +1 -29
- package/package.json +2 -2
|
@@ -1,330 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* @param {string} strategy
|
|
16
|
-
* @param {string} selector
|
|
17
|
-
* @param {Mult} mult
|
|
18
|
-
* @param {Ctx} [context]
|
|
19
|
-
* @returns {Promise<Mult extends true ? Element[] : Element>}
|
|
20
|
-
*/
|
|
21
|
-
findElOrEls<Mult extends boolean, Ctx = any>(strategy: string, selector: string, mult: Mult, context?: Ctx | undefined): Promise<Mult extends true ? import("@appium/types").Element[] : import("@appium/types").Element>;
|
|
22
|
-
/**
|
|
23
|
-
* This should override whatever's in ExternalDriver
|
|
24
|
-
* @param {string} strategy Strategy
|
|
25
|
-
* @param {string} selector Selector
|
|
26
|
-
*/
|
|
27
|
-
findElement(strategy: string, selector: string): Promise<import("@appium/types").Element>;
|
|
28
|
-
findElements(strategy: any, selector: any): Promise<import("@appium/types").Element[]>;
|
|
29
|
-
findElementFromElement(strategy: any, selector: any, elementId: any): Promise<import("@appium/types").Element>;
|
|
30
|
-
findElementsFromElement(strategy: any, selector: any, elementId: any): Promise<import("@appium/types").Element[]>;
|
|
31
|
-
getElement(id: string): FakeElement;
|
|
32
|
-
getElements(ids: string[]): FakeElement[];
|
|
33
|
-
setValue(text: string, id: string): Promise<void>;
|
|
34
|
-
elMap: Record<string, FakeElement>;
|
|
35
|
-
maxElId: number;
|
|
36
|
-
appModel: import("../fake-app").FakeApp;
|
|
37
|
-
focusedElId: string;
|
|
38
|
-
curContext: string;
|
|
39
|
-
server?: import("@appium/types").AppiumServer | undefined;
|
|
40
|
-
serverHost?: string | undefined;
|
|
41
|
-
serverPort?: number | undefined;
|
|
42
|
-
serverPath?: string | undefined;
|
|
43
|
-
setUrl?(url: string): Promise<void>;
|
|
44
|
-
getUrl?(): Promise<string>;
|
|
45
|
-
back?(): Promise<void>;
|
|
46
|
-
forward?(): Promise<void>;
|
|
47
|
-
refresh?(): Promise<void>;
|
|
48
|
-
title?(): Promise<string>;
|
|
49
|
-
getWindowHandle?(): Promise<string>;
|
|
50
|
-
closeWindow?(): Promise<string[]>;
|
|
51
|
-
setWindow?(handle: string): Promise<void>;
|
|
52
|
-
getWindowHandles?(): Promise<string[]>;
|
|
53
|
-
createNewWindow?(type?: import("@appium/types").NewWindowType | undefined): Promise<import("@appium/types").NewWindow>;
|
|
54
|
-
setFrame?(id: string | number | null): Promise<void>;
|
|
55
|
-
switchToParentFrame?(): Promise<void>;
|
|
56
|
-
getWindowRect?(): Promise<import("@appium/types").Rect>;
|
|
57
|
-
setWindowRect?(x: number, y: number, width: number, height: number): Promise<import("@appium/types").Rect>;
|
|
58
|
-
maximizeWindow?(): Promise<import("@appium/types").Rect>;
|
|
59
|
-
minimizeWindow?(): Promise<import("@appium/types").Rect>;
|
|
60
|
-
fullScreenWindow?(): Promise<import("@appium/types").Rect>;
|
|
61
|
-
active?(): Promise<import("@appium/types").Element>;
|
|
62
|
-
elementShadowRoot?(elementId: string): Promise<import("@appium/types").Element>;
|
|
63
|
-
elementSelected?(elementId: string): Promise<boolean>;
|
|
64
|
-
getAttribute?(name: string, elementId: string): Promise<string | null>;
|
|
65
|
-
getProperty?(name: string, elementId: string): Promise<string | null>;
|
|
66
|
-
getCssProperty?(name: string, elementId: string): Promise<string>;
|
|
67
|
-
getText?(elementId: string): Promise<string>;
|
|
68
|
-
getName?(elementId: string): Promise<string>;
|
|
69
|
-
getElementRect?(elementId: string): Promise<import("@appium/types").Rect>;
|
|
70
|
-
elementEnabled?(elementId: string): Promise<boolean>;
|
|
71
|
-
getComputedRole?(elementId: string): Promise<string | null>;
|
|
72
|
-
getComputedLabel?(elementId: string): Promise<string | null>;
|
|
73
|
-
elementDisplayed?(elementId: string): Promise<boolean>;
|
|
74
|
-
click?(elementId: string): Promise<void>;
|
|
75
|
-
clear?(elementId: string): Promise<void>;
|
|
76
|
-
execute?(script: string, args: unknown[]): Promise<unknown>;
|
|
77
|
-
executeAsync?(script: string, args: unknown[]): Promise<unknown>;
|
|
78
|
-
getCookies?(): Promise<import("@appium/types").Cookie[]>;
|
|
79
|
-
getCookie?(name: string): Promise<import("@appium/types").Cookie>;
|
|
80
|
-
setCookie?(cookie: import("@appium/types").Cookie): Promise<void>;
|
|
81
|
-
deleteCookie?(name: string): Promise<void>;
|
|
82
|
-
deleteCookies?(): Promise<void>;
|
|
83
|
-
performActions?(actions: import("@appium/types").ActionSequence[]): Promise<void>;
|
|
84
|
-
releaseActions?(): Promise<void>;
|
|
85
|
-
postDismissAlert?(): Promise<void>;
|
|
86
|
-
postAcceptAlert?(): Promise<void>;
|
|
87
|
-
getAlertText?(): Promise<string | null>;
|
|
88
|
-
setAlertText?(text: string): Promise<void>;
|
|
89
|
-
getScreenshot?(): Promise<string>;
|
|
90
|
-
getElementScreenshot?(elementId: string): Promise<string>;
|
|
91
|
-
mobileShake?(): Promise<void>;
|
|
92
|
-
getDeviceTime?(format?: string | undefined): Promise<string>;
|
|
93
|
-
lock?(seconds?: number | undefined): Promise<void>;
|
|
94
|
-
unlock?(): Promise<void>;
|
|
95
|
-
isLocked?(): Promise<boolean>;
|
|
96
|
-
startRecordingScreen?(options?: import("@appium/types").StartScreenRecordOptions | undefined): Promise<void>;
|
|
97
|
-
stopRecordingScreen?(options?: import("@appium/types").StopScreenRecordOptions | undefined): Promise<string>;
|
|
98
|
-
getPerformanceDataTypes?(): Promise<string[]>;
|
|
99
|
-
getPerformanceData?(packageName: string, dataType: string, dataReadTimeout?: number | undefined): Promise<string[]>;
|
|
100
|
-
pressKeyCode?(keycode: number, metastate?: number | undefined, flags?: number | undefined): Promise<void>;
|
|
101
|
-
longPressKeyCode?(keycode: number, metastate?: number | undefined, flags?: number | undefined): Promise<void>;
|
|
102
|
-
fingerprint?(fingerprintId: number): Promise<void>;
|
|
103
|
-
sendSMS?(phoneNumber: string, message: string): Promise<void>;
|
|
104
|
-
gsmCall?(phoneNumber: string, action: string): Promise<void>;
|
|
105
|
-
gsmSignal?(signalStrength: string): Promise<void>;
|
|
106
|
-
gsmVoice?(state: string): Promise<void>;
|
|
107
|
-
powerCapacity?(percent: number): Promise<void>;
|
|
108
|
-
powerAC?(state: string): Promise<void>;
|
|
109
|
-
networkSpeed?(netspeed: string): Promise<void>;
|
|
110
|
-
keyevent?(keycode: string, metastate?: string | undefined): Promise<void>;
|
|
111
|
-
mobileRotation?(x: number, y: number, radius: number, rotation: number, touchCount: number, duration: string, elementId?: string | undefined): Promise<void>;
|
|
112
|
-
getCurrentActivity?(): Promise<string>;
|
|
113
|
-
getCurrentPackage?(): Promise<string>;
|
|
114
|
-
installApp?(appPath: string, options?: unknown): Promise<void>;
|
|
115
|
-
activateApp?(appId: string, options?: unknown): Promise<void>;
|
|
116
|
-
removeApp?(appId: string, options?: unknown): Promise<void>;
|
|
117
|
-
terminateApp?(appId: string, options?: unknown): Promise<void>;
|
|
118
|
-
isAppInstalled?(appId: string): Promise<boolean>;
|
|
119
|
-
queryAppState?(appId: string): Promise<0 | 1 | 3 | 4>;
|
|
120
|
-
hideKeyboard?(strategy?: string | undefined, key?: string | undefined, keyCode?: string | undefined, keyName?: string | undefined): Promise<void>;
|
|
121
|
-
isKeyboardShown?(): Promise<boolean>;
|
|
122
|
-
pushFile?(path: string, data: string): Promise<void>;
|
|
123
|
-
pullFile?(path: string): Promise<string>;
|
|
124
|
-
pullFolder?(path: string): Promise<string>;
|
|
125
|
-
toggleFlightMode?(): Promise<void>;
|
|
126
|
-
toggleData?(): Promise<void>;
|
|
127
|
-
toggleWiFi?(): Promise<void>;
|
|
128
|
-
toggleLocationServices?(): Promise<void>;
|
|
129
|
-
openNotifications?(): Promise<void>;
|
|
130
|
-
startActivity?(appPackage: string, appActivity: string, appWaitPackage?: string | undefined, appWaitActivity?: string | undefined, intentAction?: string | undefined, intentCategory?: string | undefined, intentFlags?: string | undefined, optionalIntentArguments?: string | undefined, dontStopAppOnReset?: boolean | undefined): Promise<void>;
|
|
131
|
-
getSystemBars?(): Promise<unknown[]>;
|
|
132
|
-
getDisplayDensity?(): Promise<number>;
|
|
133
|
-
touchId?(match: boolean): Promise<void>;
|
|
134
|
-
toggleEnrollTouchId?(enabled: boolean): Promise<void>;
|
|
135
|
-
launchApp?(): Promise<void>;
|
|
136
|
-
closeApp?(): Promise<void>;
|
|
137
|
-
background?(seconds: number | null): Promise<void>;
|
|
138
|
-
endCoverage?(intent: string, path: string): Promise<void>;
|
|
139
|
-
getStrings?(language?: string | undefined, stringFile?: string | undefined): Promise<Record<string, unknown>>;
|
|
140
|
-
setValueImmediate?(value: string, elementId: string): Promise<void>;
|
|
141
|
-
replaceValue?(value: string, elementId: string): Promise<void>;
|
|
142
|
-
receiveAsyncResponse?(response: unknown): Promise<void>;
|
|
143
|
-
setClipboard?(content: string, contentType?: string | undefined, label?: string | undefined): Promise<void>;
|
|
144
|
-
getClipboard?(contentType?: string | undefined): Promise<string>;
|
|
145
|
-
asyncScriptTimeout?(ms: number): Promise<void>;
|
|
146
|
-
getWindowSize?(): Promise<import("@appium/types").Size>;
|
|
147
|
-
getLocation?(elementId: string): Promise<import("@appium/types").Position>;
|
|
148
|
-
getLocationInView?(elementId: string): Promise<import("@appium/types").Position>;
|
|
149
|
-
getSize?(elementId: string): Promise<import("@appium/types").Size>;
|
|
150
|
-
equalsElement?(elementId: string, otherElementId: string): Promise<boolean>;
|
|
151
|
-
submit?(elementId: string): Promise<void>;
|
|
152
|
-
keys?(value: string[]): Promise<void>;
|
|
153
|
-
availableIMEEngines?(): Promise<string[]>;
|
|
154
|
-
getActiveIMEEngine?(): Promise<string>;
|
|
155
|
-
isIMEActivated?(): Promise<boolean>;
|
|
156
|
-
deactivateIMEEngine?(): Promise<void>;
|
|
157
|
-
activateIMEEngine?(engine: string): Promise<void>;
|
|
158
|
-
getOrientation?(): Promise<string>;
|
|
159
|
-
setOrientation?(orientation: string): Promise<void>;
|
|
160
|
-
moveTo?(element?: string | null | undefined, xOffset?: number | undefined, yOffset?: number | undefined): Promise<void>;
|
|
161
|
-
buttonDown?(button?: number | undefined): Promise<void>;
|
|
162
|
-
buttonUp?(button?: number | undefined): Promise<void>;
|
|
163
|
-
clickCurrent?(button?: number | undefined): Promise<void>;
|
|
164
|
-
doubleClick?(): Promise<void>;
|
|
165
|
-
touchDown?(x: number, y: number): Promise<void>;
|
|
166
|
-
touchUp?(x: number, y: number): Promise<void>;
|
|
167
|
-
touchMove?(x: number, y: number): Promise<void>;
|
|
168
|
-
touchLongClick?(elementId: string): Promise<void>;
|
|
169
|
-
flick?(element?: string | undefined, xSpeed?: number | undefined, ySpeed?: number | undefined, xOffset?: number | undefined, yOffset?: number | undefined, speed?: number | undefined): Promise<void>;
|
|
170
|
-
getGeoLocation?(): Promise<import("@appium/types").Location>;
|
|
171
|
-
setGeoLocation?(location: Partial<import("@appium/types").Location>): Promise<void>;
|
|
172
|
-
getCurrentContext?(): Promise<string | null>;
|
|
173
|
-
setContext?(name: string): Promise<void>;
|
|
174
|
-
getContexts?(): Promise<string[]>;
|
|
175
|
-
getPageIndex?(elementId: string): Promise<string>;
|
|
176
|
-
getNetworkConnection?(): Promise<number>;
|
|
177
|
-
setNetworkConnection?(type: number): Promise<void>;
|
|
178
|
-
performTouch?(actions: unknown): Promise<void>;
|
|
179
|
-
performMultiAction?(actions: unknown, elementId: string): Promise<void>;
|
|
180
|
-
getRotation?(): Promise<import("@appium/types").Rotation>;
|
|
181
|
-
setRotation?(x: number, y: number, z: number): Promise<void>;
|
|
182
|
-
executeCdp?(cmd: string, params: unknown): Promise<unknown>;
|
|
183
|
-
addVirtualAuthenticator?(protocol: "ctap/u2f" | "ctap2" | "ctap2_1", transport: string, hasResidentKey?: boolean | undefined, hasUserVerification?: boolean | undefined, isUserConsenting?: boolean | undefined, isUserVerified?: boolean | undefined): Promise<string>;
|
|
184
|
-
removeVirtualAuthenticator?(authenticatorId: string): Promise<void>;
|
|
185
|
-
addAuthCredential?(credentialId: string, isResidentCredential: boolean, rpId: string, privateKey: string, userHandle: string, signCount: number, authenticatorId: string): Promise<void>;
|
|
186
|
-
getAuthCredential?(): Promise<import("@appium/types").Credential[]>;
|
|
187
|
-
removeAllAuthCredentials?(): Promise<void>;
|
|
188
|
-
removeAuthCredential?(credentialId: string, authenticatorId: string): Promise<void>;
|
|
189
|
-
setUserAuthVerified?(isUserVerified: boolean, authenticatorId: string): Promise<void>;
|
|
190
|
-
proxyCommand?<T_1 = any>(url: string, method: import("@appium/types").HTTPMethod, body?: string | undefined): Promise<T_1>;
|
|
191
|
-
cliArgs: import("@appium/types").StringRecord;
|
|
192
|
-
executeCommand(cmd: string, ...args: any[]): Promise<any>;
|
|
193
|
-
startUnexpectedShutdown(err?: Error | undefined): Promise<void>;
|
|
194
|
-
startNewCommandTimeout(): Promise<void>;
|
|
195
|
-
reset(): Promise<void>;
|
|
196
|
-
caps?: Partial<import("@appium/types").ConstraintsToCaps<{
|
|
197
|
-
readonly app: {
|
|
198
|
-
readonly presence: true;
|
|
199
|
-
readonly isString: true;
|
|
200
|
-
};
|
|
201
|
-
readonly uniqueApp: {
|
|
202
|
-
readonly isBoolean: true;
|
|
203
|
-
};
|
|
204
|
-
}> & void> | undefined;
|
|
205
|
-
originalCaps?: import("@appium/types").W3CCapabilities<{
|
|
206
|
-
readonly app: {
|
|
207
|
-
readonly presence: true;
|
|
208
|
-
readonly isString: true;
|
|
209
|
-
};
|
|
210
|
-
readonly uniqueApp: {
|
|
211
|
-
readonly isBoolean: true;
|
|
212
|
-
};
|
|
213
|
-
}, void> | undefined;
|
|
214
|
-
desiredCapConstraints: {
|
|
215
|
-
readonly app: {
|
|
216
|
-
readonly presence: true;
|
|
217
|
-
readonly isString: true;
|
|
218
|
-
};
|
|
219
|
-
readonly uniqueApp: {
|
|
220
|
-
readonly isBoolean: true;
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
assignServer?(server: import("@appium/types").AppiumServer, host: string, port: number, path: string): void;
|
|
224
|
-
getSessions(): Promise<import("@appium/types").MultiSessionData<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS, void>[]>;
|
|
225
|
-
getSession(): Promise<import("@appium/types").SingularSessionData<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS, void>>;
|
|
226
|
-
supportedLogTypes: Readonly<import("@appium/types").LogDefRecord<{
|
|
227
|
-
readonly app: {
|
|
228
|
-
readonly presence: true;
|
|
229
|
-
readonly isString: true;
|
|
230
|
-
};
|
|
231
|
-
readonly uniqueApp: {
|
|
232
|
-
readonly isBoolean: true;
|
|
233
|
-
};
|
|
234
|
-
}>>;
|
|
235
|
-
getLogTypes(): Promise<string[]>;
|
|
236
|
-
getLog(logType: string): Promise<unknown[]>;
|
|
237
|
-
findElementFromShadowRoot?(strategy: string, selector: string, shadowId: string): Promise<import("@appium/types").Element>;
|
|
238
|
-
findElementsFromShadowRoot?(strategy: string, selector: string, shadowId: string): Promise<import("@appium/types").Element[]>;
|
|
239
|
-
findElOrElsWithProcessing<Mult_1 extends boolean>(strategy: string, selector: string, mult: Mult_1, context?: any): Promise<Mult_1 extends true ? import("@appium/types").Element[] : import("@appium/types").Element>;
|
|
240
|
-
getPageSource(): Promise<string>;
|
|
241
|
-
updateSettings: (settings: import("@appium/types").StringRecord) => Promise<void>;
|
|
242
|
-
getSettings(): Promise<import("@appium/types").StringRecord>;
|
|
243
|
-
timeouts(type: string, ms: string | number, script?: number | undefined, pageLoad?: number | undefined, implicit?: string | number | undefined): Promise<void>;
|
|
244
|
-
setNewCommandTimeout(ms: number): void;
|
|
245
|
-
implicitWait(ms: string | number): Promise<void>;
|
|
246
|
-
setImplicitWait(ms: number): void;
|
|
247
|
-
implicitWaitForCondition(condition: () => Promise<any>): Promise<unknown>;
|
|
248
|
-
getTimeouts(): Promise<Record<string, number>>;
|
|
249
|
-
implicitWaitW3C(ms: number): Promise<void>;
|
|
250
|
-
implicitWaitMJSONWP(ms: number): Promise<void>;
|
|
251
|
-
pageLoadTimeoutW3C(ms: number): Promise<void>;
|
|
252
|
-
pageLoadTimeoutMJSONWP(ms: number): Promise<void>;
|
|
253
|
-
scriptTimeoutW3C(ms: number): Promise<void>;
|
|
254
|
-
scriptTimeoutMJSONWP(ms: number): Promise<void>;
|
|
255
|
-
newCommandTimeout(ms: number): Promise<void>;
|
|
256
|
-
parseTimeoutArgument(ms: string | number): number;
|
|
257
|
-
logCustomEvent(vendor: string, event: string): Promise<void>;
|
|
258
|
-
getLogEvents(type?: string | string[] | undefined): Promise<import("@appium/types").EventHistory | Record<string, number>>;
|
|
259
|
-
executeMethod(script: string, args: [] | [import("@appium/types").StringRecord]): Promise<any>;
|
|
260
|
-
createSession(w3cCaps1: import("@appium/types").W3CCapabilities<{
|
|
261
|
-
readonly app: {
|
|
262
|
-
readonly presence: true;
|
|
263
|
-
readonly isString: true;
|
|
264
|
-
};
|
|
265
|
-
readonly uniqueApp: {
|
|
266
|
-
readonly isBoolean: true;
|
|
267
|
-
};
|
|
268
|
-
}, void>, w3cCaps2?: import("@appium/types").W3CCapabilities<{
|
|
269
|
-
readonly app: {
|
|
270
|
-
readonly presence: true;
|
|
271
|
-
readonly isString: true;
|
|
272
|
-
};
|
|
273
|
-
readonly uniqueApp: {
|
|
274
|
-
readonly isBoolean: true;
|
|
275
|
-
};
|
|
276
|
-
}, void> | undefined, w3cCaps3?: import("@appium/types").W3CCapabilities<{
|
|
277
|
-
readonly app: {
|
|
278
|
-
readonly presence: true;
|
|
279
|
-
readonly isString: true;
|
|
280
|
-
};
|
|
281
|
-
readonly uniqueApp: {
|
|
282
|
-
readonly isBoolean: true;
|
|
283
|
-
};
|
|
284
|
-
}, void> | undefined, driverData?: import("@appium/types").DriverData[] | undefined): Promise<[string, any]>;
|
|
285
|
-
deleteSession(sessionId?: string | undefined, driverData?: import("@appium/types").DriverData[] | undefined): Promise<void>;
|
|
286
|
-
shouldValidateCaps: boolean;
|
|
287
|
-
sessionId: string | null;
|
|
288
|
-
opts: import("@appium/types").DriverOpts<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS>;
|
|
289
|
-
initialOpts: import("@appium/types").ServerArgs;
|
|
290
|
-
protocol?: string | undefined;
|
|
291
|
-
helpers: import("@appium/types").DriverHelpers<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS>;
|
|
292
|
-
basePath: string;
|
|
293
|
-
relaxedSecurityEnabled: boolean;
|
|
294
|
-
allowInsecure: string[];
|
|
295
|
-
denyInsecure: string[];
|
|
296
|
-
newCommandTimeoutMs: number;
|
|
297
|
-
implicitWaitMs: number;
|
|
298
|
-
locatorStrategies: string[];
|
|
299
|
-
webLocatorStrategies: string[];
|
|
300
|
-
eventEmitter: import("events");
|
|
301
|
-
settings: import("@appium/types").DeviceSettings<any>;
|
|
302
|
-
log: import("@appium/types").AppiumLogger;
|
|
303
|
-
driverData?: import("@appium/types").DriverData | undefined;
|
|
304
|
-
isCommandsQueueEnabled: boolean;
|
|
305
|
-
eventHistory: import("@appium/types").EventHistory;
|
|
306
|
-
onUnexpectedShutdown(handler: () => any): void;
|
|
307
|
-
getStatus(): Promise<any>;
|
|
308
|
-
sessionExists(sessionId: string): boolean;
|
|
309
|
-
isW3CProtocol(): boolean;
|
|
310
|
-
isMjsonwpProtocol(): boolean;
|
|
311
|
-
isFeatureEnabled(name: string): boolean;
|
|
312
|
-
assertFeatureEnabled(name: string): void;
|
|
313
|
-
validateLocatorStrategy(strategy: string, webContext?: boolean | undefined): void;
|
|
314
|
-
proxyActive(sessionId?: string | undefined): boolean;
|
|
315
|
-
getProxyAvoidList(sessionId?: string | undefined): import("@appium/types").RouteMatcher[];
|
|
316
|
-
canProxy(sessionId?: string | undefined): boolean;
|
|
317
|
-
proxyRouteIsAvoided(sessionId: string, method: string, url: string): boolean;
|
|
318
|
-
addManagedDriver(driver: import("@appium/types").Driver<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS, import("@appium/types").StringRecord, any>): void;
|
|
319
|
-
getManagedDrivers(): import("@appium/types").Driver<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS, import("@appium/types").StringRecord, any>[];
|
|
320
|
-
clearNewCommandTimeout(): Promise<void>;
|
|
321
|
-
logEvent(eventName: string): void;
|
|
322
|
-
driverForSession(sessionId: string): import("@appium/types").Core<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS> | null;
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
/**
|
|
3
|
+
* @this {FakeDriver}
|
|
4
|
+
*/
|
|
5
|
+
function getExistingElementForNode(this: import("../driver").FakeDriver, node: any): string | null;
|
|
6
|
+
/**
|
|
7
|
+
* @this {FakeDriver}
|
|
8
|
+
*/
|
|
9
|
+
function getExistingElementForNode(this: import("../driver").FakeDriver, node: any): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* @this {FakeDriver}
|
|
12
|
+
*/
|
|
13
|
+
function wrapNewEl(this: import("../driver").FakeDriver, obj: any): {
|
|
14
|
+
ELEMENT: string;
|
|
323
15
|
};
|
|
324
|
-
|
|
325
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @this {FakeDriver}
|
|
18
|
+
*/
|
|
19
|
+
function wrapNewEl(this: import("../driver").FakeDriver, obj: any): {
|
|
20
|
+
ELEMENT: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @template {boolean} Mult
|
|
24
|
+
* @template [Ctx=any]
|
|
25
|
+
* @param {string} strategy
|
|
26
|
+
* @param {string} selector
|
|
27
|
+
* @param {Mult} mult
|
|
28
|
+
* @param {Ctx} [context]
|
|
29
|
+
* @returns {Promise<Mult extends true ? Element[] : Element>}
|
|
30
|
+
* @this {FakeDriver}
|
|
31
|
+
*/
|
|
32
|
+
function findElOrEls<Mult extends boolean, Ctx = any>(this: import("../driver").FakeDriver, strategy: string, selector: string, mult: Mult, context?: Ctx | undefined): Promise<Mult extends true ? import("@appium/types").Element[] : import("@appium/types").Element>;
|
|
33
|
+
/**
|
|
34
|
+
* @template {boolean} Mult
|
|
35
|
+
* @template [Ctx=any]
|
|
36
|
+
* @param {string} strategy
|
|
37
|
+
* @param {string} selector
|
|
38
|
+
* @param {Mult} mult
|
|
39
|
+
* @param {Ctx} [context]
|
|
40
|
+
* @returns {Promise<Mult extends true ? Element[] : Element>}
|
|
41
|
+
* @this {FakeDriver}
|
|
42
|
+
*/
|
|
43
|
+
function findElOrEls<Mult extends boolean, Ctx = any>(this: import("../driver").FakeDriver, strategy: string, selector: string, mult: Mult, context?: Ctx | undefined): Promise<Mult extends true ? import("@appium/types").Element[] : import("@appium/types").Element>;
|
|
44
|
+
/**
|
|
45
|
+
* This should override whatever's in ExternalDriver
|
|
46
|
+
* @param {string} strategy Strategy
|
|
47
|
+
* @param {string} selector Selector
|
|
48
|
+
* @this {FakeDriver}
|
|
49
|
+
*/
|
|
50
|
+
function findElement(this: import("../driver").FakeDriver, strategy: string, selector: string): Promise<import("@appium/types").Element>;
|
|
51
|
+
/**
|
|
52
|
+
* This should override whatever's in ExternalDriver
|
|
53
|
+
* @param {string} strategy Strategy
|
|
54
|
+
* @param {string} selector Selector
|
|
55
|
+
* @this {FakeDriver}
|
|
56
|
+
*/
|
|
57
|
+
function findElement(this: import("../driver").FakeDriver, strategy: string, selector: string): Promise<import("@appium/types").Element>;
|
|
58
|
+
/**
|
|
59
|
+
* @this {FakeDriver}
|
|
60
|
+
*/
|
|
61
|
+
function findElements(this: import("../driver").FakeDriver, strategy: any, selector: any): Promise<import("@appium/types").Element[]>;
|
|
62
|
+
/**
|
|
63
|
+
* @this {FakeDriver}
|
|
64
|
+
*/
|
|
65
|
+
function findElements(this: import("../driver").FakeDriver, strategy: any, selector: any): Promise<import("@appium/types").Element[]>;
|
|
66
|
+
/**
|
|
67
|
+
* @this {FakeDriver}
|
|
68
|
+
*/
|
|
69
|
+
function findElementFromElement(this: import("../driver").FakeDriver, strategy: any, selector: any, elementId: any): Promise<import("@appium/types").Element>;
|
|
70
|
+
/**
|
|
71
|
+
* @this {FakeDriver}
|
|
72
|
+
*/
|
|
73
|
+
function findElementFromElement(this: import("../driver").FakeDriver, strategy: any, selector: any, elementId: any): Promise<import("@appium/types").Element>;
|
|
74
|
+
/**
|
|
75
|
+
* @this {FakeDriver}
|
|
76
|
+
*/
|
|
77
|
+
function findElementsFromElement(this: import("../driver").FakeDriver, strategy: any, selector: any, elementId: any): Promise<import("@appium/types").Element[]>;
|
|
78
|
+
/**
|
|
79
|
+
* @this {FakeDriver}
|
|
80
|
+
*/
|
|
81
|
+
function findElementsFromElement(this: import("../driver").FakeDriver, strategy: any, selector: any, elementId: any): Promise<import("@appium/types").Element[]>;
|
|
82
|
+
}
|
|
83
|
+
export default _default;
|
|
326
84
|
export type Element = import('@appium/types').Element;
|
|
327
|
-
export type
|
|
328
|
-
export type IFindCommands<Ctx = any> = import('@appium/types').IFindCommands<Ctx>;
|
|
329
|
-
import { FakeElement } from "../fake-element";
|
|
85
|
+
export type FakeDriver = import('../driver').FakeDriver;
|
|
330
86
|
//# sourceMappingURL=find.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../lib/commands/find.js"],"names":[],"mappings":";IAKE;;OAEG;IACH,mGAOC;IAVD;;OAEG;IACH,mGAOC;IAED;;OAEG;IACH;;MAWC;IAdD;;OAEG;IACH;;MAWC;IAED;;;;;;;;;OASG;IACH,yQAmCC;IA7CD;;;;;;;;;OASG;IACH,yQAmCC;IAED;;;;;OAKG;IACH,yIAEC;IARD;;;;;OAKG;IACH,yIAEC;IAED;;OAEG;IACH,sIAEC;IALD;;OAEG;IACH,sIAEC;IAED;;OAEG;IACH,8JAGC;IAND;;OAEG;IACH,8JAGC;IAED;;OAEG;IACH,iKAGC;IAND;;OAEG;IACH,iKAGC;;;sBAIU,OAAO,eAAe,EAAE,OAAO;yBAC/B,OAAO,WAAW,EAAE,UAAU"}
|
|
@@ -3,119 +3,115 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FindMixin = void 0;
|
|
7
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const driver_1 = require("appium/driver");
|
|
9
8
|
const fake_element_1 = require("../fake-element");
|
|
10
|
-
|
|
11
|
-
* @template {Class<import('../types').IElementCommands>} T
|
|
12
|
-
* @param {T} Base
|
|
13
|
-
*/
|
|
14
|
-
function FindMixin(Base) {
|
|
9
|
+
exports.default = {
|
|
15
10
|
/**
|
|
16
|
-
* @
|
|
11
|
+
* @this {FakeDriver}
|
|
17
12
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return id;
|
|
23
|
-
}
|
|
13
|
+
getExistingElementForNode(node) {
|
|
14
|
+
for (let [id, el] of lodash_1.default.toPairs(this.elMap)) {
|
|
15
|
+
if (el.node === node) {
|
|
16
|
+
return id;
|
|
24
17
|
}
|
|
25
|
-
return null;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return { ELEMENT:
|
|
19
|
+
return null;
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* @this {FakeDriver}
|
|
23
|
+
*/
|
|
24
|
+
wrapNewEl(obj) {
|
|
25
|
+
// first check and see if we already have a ref to this element
|
|
26
|
+
let existingElId = this.getExistingElementForNode(obj);
|
|
27
|
+
if (existingElId) {
|
|
28
|
+
return { ELEMENT: existingElId };
|
|
37
29
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
30
|
+
// otherwise add the element to the map
|
|
31
|
+
this.maxElId++;
|
|
32
|
+
this.elMap[this.maxElId.toString()] = new fake_element_1.FakeElement(obj, this.appModel);
|
|
33
|
+
return { ELEMENT: this.maxElId.toString() };
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* @template {boolean} Mult
|
|
37
|
+
* @template [Ctx=any]
|
|
38
|
+
* @param {string} strategy
|
|
39
|
+
* @param {string} selector
|
|
40
|
+
* @param {Mult} mult
|
|
41
|
+
* @param {Ctx} [context]
|
|
42
|
+
* @returns {Promise<Mult extends true ? Element[] : Element>}
|
|
43
|
+
* @this {FakeDriver}
|
|
44
|
+
*/
|
|
45
|
+
async findElOrEls(strategy, selector, mult, context) {
|
|
46
|
+
let qMap = {
|
|
47
|
+
xpath: 'xpathQuery',
|
|
48
|
+
id: 'idQuery',
|
|
49
|
+
'accessibility id': 'idQuery',
|
|
50
|
+
'class name': 'classQuery',
|
|
51
|
+
'tag name': 'classQuery',
|
|
52
|
+
'css selector': 'cssQuery',
|
|
53
|
+
};
|
|
54
|
+
// TODO this error checking should probably be part of MJSONWP?
|
|
55
|
+
if (!lodash_1.default.includes(lodash_1.default.keys(qMap), strategy)) {
|
|
56
|
+
throw new driver_1.errors.UnknownCommandError();
|
|
57
|
+
}
|
|
58
|
+
if (selector === 'badsel') {
|
|
59
|
+
throw new driver_1.errors.InvalidSelectorError();
|
|
60
|
+
}
|
|
61
|
+
let els = this.appModel[qMap[strategy]](selector, context);
|
|
62
|
+
let retval;
|
|
63
|
+
if (els.length) {
|
|
64
|
+
if (mult) {
|
|
65
|
+
let allEls = [];
|
|
66
|
+
for (let el of els) {
|
|
67
|
+
allEls.push(this.wrapNewEl(el));
|
|
75
68
|
}
|
|
76
|
-
|
|
77
|
-
else if (mult) {
|
|
78
|
-
retval = [];
|
|
69
|
+
retval = allEls;
|
|
79
70
|
}
|
|
80
71
|
else {
|
|
81
|
-
|
|
72
|
+
retval = this.wrapNewEl(els[0]);
|
|
82
73
|
}
|
|
83
|
-
return /** @type {Mult extends true ? Element[] : Element} */ (retval);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* This should override whatever's in ExternalDriver
|
|
87
|
-
* @param {string} strategy Strategy
|
|
88
|
-
* @param {string} selector Selector
|
|
89
|
-
*/
|
|
90
|
-
async findElement(strategy, selector) {
|
|
91
|
-
return this.findElOrEls(strategy, selector, false);
|
|
92
74
|
}
|
|
93
|
-
|
|
94
|
-
|
|
75
|
+
else if (mult) {
|
|
76
|
+
retval = [];
|
|
95
77
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return this.findElOrEls(strategy, selector, false, el.xmlFragment);
|
|
78
|
+
else {
|
|
79
|
+
throw new driver_1.errors.NoSuchElementError();
|
|
99
80
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
81
|
+
return /** @type {Mult extends true ? Element[] : Element} */ (retval);
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* This should override whatever's in ExternalDriver
|
|
85
|
+
* @param {string} strategy Strategy
|
|
86
|
+
* @param {string} selector Selector
|
|
87
|
+
* @this {FakeDriver}
|
|
88
|
+
*/
|
|
89
|
+
async findElement(strategy, selector) {
|
|
90
|
+
return this.findElOrEls(strategy, selector, false);
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* @this {FakeDriver}
|
|
94
|
+
*/
|
|
95
|
+
async findElements(strategy, selector) {
|
|
96
|
+
return this.findElOrEls(strategy, selector, true);
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* @this {FakeDriver}
|
|
100
|
+
*/
|
|
101
|
+
async findElementFromElement(strategy, selector, elementId) {
|
|
102
|
+
let el = this.getElement(elementId);
|
|
103
|
+
return this.findElOrEls(strategy, selector, false, el.xmlFragment);
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* @this {FakeDriver}
|
|
107
|
+
*/
|
|
108
|
+
async findElementsFromElement(strategy, selector, elementId) {
|
|
109
|
+
let el = this.getElement(elementId);
|
|
110
|
+
return this.findElOrEls(strategy, selector, true, el.xmlFragment);
|
|
111
|
+
},
|
|
112
|
+
};
|
|
108
113
|
/**
|
|
109
|
-
* @typedef {import('../driver').FakeDriverCore} FakeDriverCore
|
|
110
114
|
* @typedef {import('@appium/types').Element} Element
|
|
111
|
-
|
|
112
|
-
*/
|
|
113
|
-
/**
|
|
114
|
-
* @template T,[U={}],[V=Array<any>]
|
|
115
|
-
* @typedef {import('@appium/types').Class<T,U,V>} Class
|
|
116
|
-
*/
|
|
117
|
-
/**
|
|
118
|
-
* @template [Ctx=any]
|
|
119
|
-
* @typedef {import('@appium/types').IFindCommands<Ctx>} IFindCommands
|
|
115
|
+
* @typedef {import('../driver').FakeDriver} FakeDriver
|
|
120
116
|
*/
|
|
121
117
|
//# sourceMappingURL=find.js.map
|