-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathui-element.d.ts
165 lines (165 loc) · 4.45 KB
/
ui-element.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
import { Point } from "./point";
import { Direction } from "./direction";
import { INsCapabilities } from "./interfaces/ns-capabilities";
export declare class UIElement {
private _element;
private _driver;
private _wd;
private _webio;
private _args;
private _searchMethod;
private _searchParams;
private _index?;
private static readonly DEFAULT_REFETCH_TIME;
constructor(_element: any, _driver: any, _wd: any, _webio: any, _args: INsCapabilities, _searchMethod: string, _searchParams: string, _index?: number);
/**
* Click on element
*/
click(): Promise<any>;
tapCenter(): Promise<void>;
tapAtTheEnd(): Promise<void>;
/**
* @deprecated
* Tap on element
* This method is not working very good with UiAutomator2
* It is better to use click instead.
*/
tap(): Promise<any>;
/**
* Double tap on element
*/
doubleTap(): Promise<any>;
/**
* Get location of element
*/
location(): Promise<Point>;
/**
* Get size of element
*/
size(): Promise<Point>;
/**
* Get text of element
*/
text(): Promise<any>;
/**
* Returns if an element is selected
*/
isSelected(): Promise<any>;
/**
* Selected an element
*/
select(retries?: number): Promise<any>;
/**
* Returns if an element is checked
*/
isChecked(): Promise<boolean>;
/**
* Get web driver element
*/
element(): Promise<any>;
/**
* Shows if element is displayed. Returns true or false. If the element doesn't exist it will return false
*/
isDisplayed(): Promise<boolean>;
/**
* Returns true or false
*/
exists(): Promise<boolean>;
/**
* Waits until the element exists not.
* @param wait
*/
waitForExistNot(wait?: number): Promise<any>;
/**
* Wait until the elements appear
* @param wait
*/
waitForExist(wait?: number): Promise<any>;
/**
* Get attribute of element
* @param attr
*/
getAttribute(attr: any): Promise<any>;
/**
* Get rectangle of element
*/
getRectangle(): Promise<{
x: number;
y: number;
width: number;
height: number;
}>;
/**
* Get rectangle of element in actual dimensions
*/
getActualRectangle(): Promise<{
x: number;
y: number;
width: number;
height: number;
}>;
/**
* Scroll with offset from element with minimum inertia
* @param direction
* @param yOffset
* @param xOffset
*/
scroll(direction: Direction, yOffset?: number, xOffset?: number): Promise<void>;
/**
* Scroll with offset from element with minimum inertia
* @param direction
* @param yOffset
* @param xOffset
*/
scrollTo(direction: Direction, elementToSearch: () => Promise<UIElement>, yOffset?: number, xOffset?: number, retries?: number): Promise<UIElement>;
/**
* Drag element with specific offset
* @param direction
* @param yOffset
* @param xOffset - default value 0
*/
drag(direction: Direction, yOffset: number, xOffset?: number): Promise<void>;
/**
* Click and hold over an element
* @param time in milliseconds to increase the default press period.
*/
hold(time?: number): Promise<void>;
/**
* Send keys to field or other UI component
* @param text
* @param shouldClearText, default value is true
* @param useAdb, default value is false. Usable for Android ONLY !
*/
sendKeys(text: string, shouldClearText?: boolean, useAdb?: boolean): Promise<void>;
/**
* Type text to field or other UI component
* @param text
* @param shouldClearText, default value is true
*/
type(text: string, shouldClearText?: boolean): Promise<void>;
/**
* Send key code to device
* @param key code
*/
pressKeycode(keyCode: number): Promise<void>;
/**
* Clears text from ui element
*/
clearText(): Promise<void>;
/**
* Clears text from ui element with ADB. Android ONLY !
* @param charactersCount Characters count to delete. (Optional - default value 10)
*/
adbDeleteText(charactersCount?: number): Promise<void>;
log(): Promise<void>;
refetch(): Promise<any>;
/**
* Easy to use in order to chain and search for nested elements
*/
driver(): any;
/**
* Swipe element left/right
* @param direction
*/
swipe(direction: Direction): Promise<void>;
}