This repository was archived by the owner on Oct 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDriverInterface.php
348 lines (306 loc) · 6.99 KB
/
DriverInterface.php
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<?php
/**
* Copyright © 2017 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Mtf\Client;
/**
* Interface DriverInterface
*/
interface DriverInterface
{
/**
* Click
*
* @param ElementInterface $element
* @return void
*/
public function click(ElementInterface $element);
/**
* Double click
*
* @param ElementInterface $element
* @return void
*/
public function doubleClick(ElementInterface $element);
/**
* Right click
*
* @param ElementInterface $element
* @return void
*/
public function rightClick(ElementInterface $element);
/**
* Check whether element is present in the DOM.
*
* @param ElementInterface $element
* @return bool
*/
public function isPresent(ElementInterface $element);
/**
* Check whether element is visible
*
* @param ElementInterface $element
* @return bool
*/
public function isVisible(ElementInterface $element);
/**
* Check whether element is enabled
*
* @param ElementInterface $element
* @return bool
*/
public function isDisabled(ElementInterface $element);
/**
* Check whether element is selected
*
* @param ElementInterface $element
* @return bool
*/
public function isSelected(ElementInterface $element);
/**
* Set the value
*
* @param ElementInterface $element
* @param string|array $value
* @return void
*/
public function setValue(ElementInterface $element, $value);
/**
* Get the value
*
* @param ElementInterface $element
* @return null|string
*/
public function getValue(ElementInterface $element);
/**
* Get content
*
* @param ElementInterface $element
* @return string
*/
public function getText(ElementInterface $element);
/**
* Find element on the page
*
* @param string $selector
* @param string $strategy
* @param string $type = select|multiselect|checkbox|null OR custom class with full namespace
* @param ElementInterface $context
* @return ElementInterface
*/
public function find(
$selector,
$strategy = Locator::SELECTOR_CSS,
$type = null,
ElementInterface $context = null
);
/**
* Drag and drop element to(between) another element(s)
*
* @param ElementInterface $element
* @param ElementInterface $target
* @return void
*/
public function dragAndDrop(ElementInterface $element, ElementInterface $target);
/**
* Send a sequence of key strokes to the active element.
*
* @param ElementInterface $element
* @param array $keys
* @return void
*/
public function keys(ElementInterface $element, array $keys);
/**
* Wait until callback isn't null or timeout occurs
*
* @param callable $callback
* @return mixed
*/
public function waitUntil($callback);
/**
* Get all elements by locator
*
* @param ElementInterface $context
* @param string $selector
* @param string $strategy
* @param null|string $type
* @param bool $wait
* @return ElementInterface[]
*/
public function getElements(
ElementInterface $context,
$selector,
$strategy = Locator::SELECTOR_CSS,
$type = null,
$wait = true
);
/**
* Get the value of a the given attribute of the element
*
* @param ElementInterface $element
* @param string $name
* @return string
*/
public function getAttribute(ElementInterface $element, $name);
/**
* Open page
*
* @param string $url
* @return void
*/
public function open($url);
/**
* Back to previous page
* @return void
*/
public function back();
/**
* Forward page
*
* @return void
*/
public function forward();
/**
* Refresh page
*
* @return void
*/
public function refresh();
/**
* Reopen browser
*
* @return void
*/
public function reopen();
/**
* Change the focus to a frame in the page by locator
*
* @param Locator $locator
* @return void
*/
public function switchToFrame(Locator $locator);
/**
* Open new tab in Browser.
*
* @return void
*/
public function openWindow();
/**
* Close the current window or specified one.
*
* @param string|null $handle [optional]
* @return void
*/
public function closeWindow($handle = null);
/**
* Changes the focus to the specified window or to the latest one.
*
* @param string|null $handle [optional]
* @return void
*/
public function selectWindow($handle = null);
/**
* Retrieves the current window handle.
*
* @return string
*/
public function getCurrentWindow();
/**
* Retrieves a list of all available window handles.
*
* @return array
*/
public function getWindowHandles();
/**
* Get page title text.
*
* @return string
*/
public function getTitle();
/**
* Press OK on an alert, or confirms a dialog
*
* @return void
*/
public function acceptAlert();
/**
* Press Cancel on an alert, or does not confirm a dialog
*
* @return void
*/
public function dismissAlert();
/**
* Get the alert dialog text
*
* @return string
*/
public function getAlertText();
/**
* Set the text to a prompt popup
*
* @param string $text
* @return void
*/
public function setAlertText($text);
/**
* Get current page url
*
* @return string
*/
public function getUrl();
/**
* Get Html page source
*
* @return string
*/
public function getHtmlSource();
/**
* Get binary string of image
*
* @return string
*/
public function getScreenshotData();
/**
* Inject Js Error collector
*
* @return void
*/
public function injectJsErrorCollector();
/**
* Get js errors
*
* @return string[]
*/
public function getJsErrors();
/**
* Set focus on element
*
* @param ElementInterface $element
* @return mixed
*/
public function focus(ElementInterface $element);
/**
* Hover mouse over an element.
*
* @param ElementInterface $element
* @return void
*/
public function hover(ElementInterface $element);
/**
* Upload file.
*
* @param ElementInterface $element
* @param string $path
* @return void
*/
public function uploadFile(ElementInterface $element, $path);
/**
* Press a modifier key.
*
* @param string $key
* @param bool $isSpecialKey
* @return mixed
*/
public function pressKey($key, $isSpecialKey = false);
}