-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathappium-driver.d.ts
212 lines (212 loc) · 7.94 KB
/
appium-driver.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
export declare var should: any;
import { ElementHelper } from "./element-helper";
import { SearchOptions } from "./search-options";
import { UIElement } from "./ui-element";
import { Direction } from "./direction";
import { Locator } from "./locators";
import { INsCapabilities } from "./interfaces/ns-capabilities";
import { IRectangle } from "./interfaces/rectangle";
import { Point } from "./point";
import { ImageHelper } from "./image-helper";
import { ImageOptions } from "./image-options";
export declare class AppiumDriver {
private _driver;
private _wd;
private _webio;
private _driverConfig;
private _args;
private static pngFileExt;
private static partialUrl;
private _defaultWaitTime;
private _elementHelper;
private _imageHelper;
private _isAlive;
private _locators;
private _logPath;
private _storageByDeviceName;
private _storageByPlatform;
private constructor();
readonly imageHelper: ImageHelper;
defaultWaitTime: number;
readonly capabilities: any;
readonly nsCapabilities: INsCapabilities;
readonly platformName: any;
readonly platformVersion: any;
readonly elementHelper: ElementHelper;
readonly locators: Locator;
readonly isAlive: boolean;
readonly isAndroid: boolean;
readonly isIOS: boolean;
readonly driver: any;
webio(): any;
wd(): any;
click(args: any): Promise<any>;
navBack(): Promise<any>;
/**
* Get the storage where test results from image comparisson is logged It will be reports/app nam/device name
*/
readonly reportsPath: string;
/**
* Get the storage where images are captured by platform. It will be resources/app nam/platform name
*/
readonly storageByPlatform: string;
/**
* Get the storage where images are captured. It will be resources/app nam/device name
*/
readonly storageByDeviceName: string;
static createAppiumDriver(port: number, args: INsCapabilities): Promise<AppiumDriver>;
private static applyDeviceAdditionsSettings(args, sessionIfno);
/**
*
* @param xPath
* @param waitForElement
*/
findElementByXPath(xPath: string, waitForElement?: number): Promise<UIElement>;
/**
*
* @param xPath
* @param waitForElement
*/
findElementsByXPath(xPath: string, waitForElement?: number): Promise<UIElement[]>;
/**
* Search for element by given text. The seacrch is case insensitive for android
* @param text
* @param match
* @param waitForElement
*/
findElementByText(text: string, match?: SearchOptions, waitForElement?: number): Promise<UIElement>;
/**
* Search for elements by given text. The seacrch is case insensitive for android
* @param text
* @param match
* @param waitForElement
*/
findElementsByText(text: string, match?: SearchOptions, waitForElement?: number): Promise<UIElement[]>;
/**
* Searches for element by element native class name like button, textView etc which will be translated to android.widgets.Button or XCUIElementTypeButton (iOS 10 and higher) or UIElementButton (iOS 9)
* Notice this is not the same as css class
* @param className
* @param waitForElement
*/
findElementByClassName(className: string, waitForElement?: number): Promise<UIElement>;
/**
* Searches for element by element native class name like button, textView etc which will be translated to android.widgets.Button or XCUIElementTypeButton (iOS 10 and higher) or UIElementButton (iOS 9)
* Notice this is not the same as css class
* @param className
* @param waitForElement
*/
findElementsByClassName(className: string, waitForElement?: number): Promise<UIElement[]>;
/**
* Find element by automationText
* @param id
* @param waitForElement
*/
findElementByAccessibilityId(id: any, waitForElement?: number): Promise<UIElement>;
/**
* Find elements by automationText
* @param id
* @param waitForElement
*/
findElementsByAccessibilityId(id: string, waitForElement?: number): Promise<UIElement[]>;
/**
* Scrolls from point to other point with minimum inertia
* @param direction
* @param y
* @param x
* @param yOffset
* @param xOffset
*/
scroll(direction: Direction, y: number, x: number, yOffset: number, xOffset?: number): Promise<void>;
/**
*
* @param direction
* @param element
* @param startPoint
* @param yOffset
* @param xOffset
* @param retryCount
*/
scrollTo(direction: Direction, element: any, startPoint: Point, yOffset: number, xOffset?: number, retryCount?: number): Promise<any>;
/**
* Swipe from point with offset and inertia according to duatio
* @param y
* @param x
* @param yOffset
* @param inertia
* @param xOffset
*/
swipe(y: number, x: number, yOffset: number, inertia?: number, xOffset?: number): Promise<void>;
/**
* Click a point by providing coordinates
* @param x
* @param y
*/
clickPoint(xCoordinate: number, yCoordinate: number): Promise<void>;
source(): Promise<any>;
sessionId(): Promise<any>;
compareElement(element: UIElement, imageName: string, tolerance?: number, timeOutSeconds?: number, toleranceType?: ImageOptions): Promise<boolean>;
compareRectangle(rect: IRectangle, imageName: string, timeOutSeconds?: number, tolerance?: number, toleranceType?: ImageOptions): Promise<boolean>;
compareScreen(imageName: string, timeOutSeconds?: number, tolerance?: number, toleranceType?: ImageOptions): Promise<boolean>;
/**
* @param videoName
* @param callback when to stop video recording. In order an element is found. Should return true to exit
*/
recordVideo(videoName: any, callback: () => Promise<any>): Promise<any>;
private _recordVideoInfo;
/**
* @param videoName
*/
startRecordingVideo(videoName: any): any;
stopRecordingVideo(): Promise<any>;
private compare(imageName, timeOutSeconds?, tolerance?, rect?, toleranceType?);
prepareImageToCompare(filePath: string, rect: IRectangle): Promise<void>;
takeScreenshot(fileName: string): Promise<string>;
logScreenshot(fileName: string): Promise<string>;
logPageSource(fileName: string): Promise<void>;
/**
* Send the currently active app to the background
* @param time
*/
backgroundApp(time: number): Promise<void>;
resetApp(): Promise<void>;
init(): Promise<void>;
quit(): Promise<void>;
private static applyAdditionalSettings(args);
private convertArrayToUIElements(array, searchM, args);
private static configureLogging(driver, verbose);
private getExpectedImagePath(imageName);
/**
* Wait specific amount of time before continue execution
* @param miliseconds
*/
sleep(miliseconds: number): Promise<void>;
/**
* Wait specific amount of time before continue execution
* @param miliseconds
*/
wait(miliseconds: number): void;
/**
* Search for element by given xPath but does not throw error if can not find it. Instead returns 'undefined'.
* @param xPath
* @param waitForElement
*/
findElementByXPathIfExists(xPath: string, waitForElement?: number): Promise<UIElement>;
/**
* Search for element by given text but does not throw error if can not find it. Instead returns 'undefined'.
* @param text
* @param match
* @param waitForElement
*/
findElementByTextIfExists(text: string, match?: SearchOptions, waitForElement?: number): Promise<UIElement>;
/**
* Search for element by automationText but does not throw error if can not find it. Instead returns 'undefined'.
* @param id
* @param waitForElement
*/
findElementByAccessibilityIdIfExists(id: string, waitForElement?: number): Promise<UIElement>;
executeShellCommand(commandAndargs: {
command: string;
"args": Array<any>;
}): Promise<any>;
setDontKeepActivities(value: boolean): Promise<void>;
}