-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathRobot.java
188 lines (133 loc) · 4.08 KB
/
Robot.java
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
/*
* The MIT License
*
* Copyright 2022 Karate Labs Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.intuit.karate.robot;
import com.intuit.karate.core.AutoDef;
import com.intuit.karate.core.Plugin;
import java.util.List;
import java.util.function.Predicate;
import java.util.function.Supplier;
/**
*
* @author pthomas3
*/
public interface Robot extends Plugin {
static final List<String> METHOD_NAMES = Plugin.methodNames(Robot.class);
@Override
default List<String> methodNames() {
return METHOD_NAMES;
}
@AutoDef
Robot retry();
@AutoDef
Robot retry(int count);
@AutoDef
Robot retry(Integer count, Integer interval);
@AutoDef
Robot delay(int millis);
@AutoDef
Robot click();
@AutoDef
Robot click(int num);
@AutoDef
Robot doubleClick();
@AutoDef
Robot rightClick();
@AutoDef
Robot press();
@AutoDef
Robot release();
@AutoDef
Robot input(String[] values);
@AutoDef
Robot input(String[] values, int delay);
@AutoDef
Robot input(String chars, int delay);
@AutoDef
Robot input(String value);
@AutoDef
Element input(String locator, String value);
@AutoDef
byte[] screenshot();
@AutoDef
byte[] screenshotActive();
@AutoDef
Robot move(int x, int y);
@AutoDef
Robot click(int x, int y);
@AutoDef
Element highlight(String locator);
@AutoDef
List<Element> highlightAll(String locator);
@AutoDef
Element locate(String locator);
@AutoDef
List<Element> locateAll(String locator);
@AutoDef
Element optional(String locator);
@AutoDef
boolean exists(String locator);
@AutoDef
Element move(String locator);
@AutoDef
Element focus(String locator);
@AutoDef
Element click(String locator);
@AutoDef
Element select(String locator);
@AutoDef
Element press(String locator);
@AutoDef
Element release(String locator);
@AutoDef
Element window(String title);
@AutoDef
Element window(Predicate<String> condition);
@AutoDef
boolean windowExists(String locator);
@AutoDef
Element windowOptional(String locator);
@AutoDef
Element waitForWindowOptional(String locator);
@AutoDef
Object waitUntil(Supplier<Object> condition);
@AutoDef
Object waitUntilOptional(Supplier<Object> condition);
@AutoDef
Element waitFor(String locator);
@AutoDef
Element waitForOptional(String locator);
@AutoDef
Element waitForAny(String locator1, String locator2);
@AutoDef
Element waitForAny(String[] locators);
@AutoDef
Element activate(String locator);
List<Window> getAllWindows(); // purely for debug convenience
Element getActive(); // getter
Robot setActive(Element e); // setter
Element getRoot(); // getter
Element getFocused(); // getter
String getClipboard(); // getter
Location getLocation(); // getter
}