line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Selenium::Remote::Commands; |
2
|
|
|
|
|
|
|
$Selenium::Remote::Commands::VERSION = '1.49'; |
3
|
16
|
|
|
16
|
|
55699
|
use strict; |
|
16
|
|
|
|
|
57
|
|
|
16
|
|
|
|
|
474
|
|
4
|
16
|
|
|
16
|
|
85
|
use warnings; |
|
16
|
|
|
|
|
47
|
|
|
16
|
|
|
|
|
439
|
|
5
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
93
|
use Carp qw{croak}; |
|
16
|
|
|
|
|
46
|
|
|
16
|
|
|
|
|
771
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Implement commands for Selenium::Remote::Driver for use with webdriver 2 |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
16
|
|
|
16
|
|
1141
|
use Moo; |
|
16
|
|
|
|
|
24210
|
|
|
16
|
|
|
|
|
103
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has '_cmds' => ( |
14
|
|
|
|
|
|
|
is => 'lazy', |
15
|
|
|
|
|
|
|
reader => 'get_cmds', |
16
|
|
|
|
|
|
|
builder => sub { |
17
|
|
|
|
|
|
|
return { |
18
|
26
|
|
|
26
|
|
5027
|
'status' => { |
19
|
|
|
|
|
|
|
'method' => 'GET', |
20
|
|
|
|
|
|
|
'url' => 'status', |
21
|
|
|
|
|
|
|
'no_content_success' => 0 |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
'newSession' => { |
24
|
|
|
|
|
|
|
'method' => 'POST', |
25
|
|
|
|
|
|
|
'url' => 'session', |
26
|
|
|
|
|
|
|
'no_content_success' => 0 |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
'getSessions' => { |
29
|
|
|
|
|
|
|
'method' => 'GET', |
30
|
|
|
|
|
|
|
'url' => 'sessions', |
31
|
|
|
|
|
|
|
'no_content_success' => 0 |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
'getCapabilities' => { |
34
|
|
|
|
|
|
|
'method' => 'GET', |
35
|
|
|
|
|
|
|
'url' => 'session/:sessionId', |
36
|
|
|
|
|
|
|
'no_content_success' => 0 |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
'setTimeout' => { |
39
|
|
|
|
|
|
|
'method' => 'POST', |
40
|
|
|
|
|
|
|
'url' => 'session/:sessionId/timeouts', |
41
|
|
|
|
|
|
|
'no_content_success' => 1 |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
'setAsyncScriptTimeout' => { |
44
|
|
|
|
|
|
|
'method' => 'POST', |
45
|
|
|
|
|
|
|
'url' => 'session/:sessionId/timeouts/async_script', |
46
|
|
|
|
|
|
|
'no_content_success' => 1 |
47
|
|
|
|
|
|
|
}, |
48
|
|
|
|
|
|
|
'setImplicitWaitTimeout' => { |
49
|
|
|
|
|
|
|
'method' => 'POST', |
50
|
|
|
|
|
|
|
'url' => 'session/:sessionId/timeouts/implicit_wait', |
51
|
|
|
|
|
|
|
'no_content_success' => 1 |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
'quit' => { |
54
|
|
|
|
|
|
|
'method' => 'DELETE', |
55
|
|
|
|
|
|
|
'url' => 'session/:sessionId', |
56
|
|
|
|
|
|
|
'no_content_success' => 1 |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
'getCurrentWindowHandle' => { |
59
|
|
|
|
|
|
|
'method' => 'GET', |
60
|
|
|
|
|
|
|
'url' => 'session/:sessionId/window_handle', |
61
|
|
|
|
|
|
|
'no_content_success' => 0 |
62
|
|
|
|
|
|
|
}, |
63
|
|
|
|
|
|
|
'getWindowHandles' => { |
64
|
|
|
|
|
|
|
'method' => 'GET', |
65
|
|
|
|
|
|
|
'url' => 'session/:sessionId/window_handles', |
66
|
|
|
|
|
|
|
'no_content_success' => 0 |
67
|
|
|
|
|
|
|
}, |
68
|
|
|
|
|
|
|
'getWindowSize' => { |
69
|
|
|
|
|
|
|
'method' => 'GET', |
70
|
|
|
|
|
|
|
'url' => 'session/:sessionId/window/:windowHandle/size', |
71
|
|
|
|
|
|
|
'no_content_success' => 0 |
72
|
|
|
|
|
|
|
}, |
73
|
|
|
|
|
|
|
'getWindowPosition' => { |
74
|
|
|
|
|
|
|
'method' => 'GET', |
75
|
|
|
|
|
|
|
'url' => 'session/:sessionId/window/:windowHandle/position', |
76
|
|
|
|
|
|
|
'no_content_success' => 0 |
77
|
|
|
|
|
|
|
}, |
78
|
|
|
|
|
|
|
'maximizeWindow' => { |
79
|
|
|
|
|
|
|
'method' => 'POST', |
80
|
|
|
|
|
|
|
'url' => 'session/:sessionId/window/:windowHandle/maximize', |
81
|
|
|
|
|
|
|
'no_content_success' => 1 |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
'setWindowSize' => { |
84
|
|
|
|
|
|
|
'method' => 'POST', |
85
|
|
|
|
|
|
|
'url' => 'session/:sessionId/window/:windowHandle/size', |
86
|
|
|
|
|
|
|
'no_content_success' => 1 |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
'setWindowPosition' => { |
89
|
|
|
|
|
|
|
'method' => 'POST', |
90
|
|
|
|
|
|
|
'url' => 'session/:sessionId/window/:windowHandle/position', |
91
|
|
|
|
|
|
|
'no_content_success' => 1 |
92
|
|
|
|
|
|
|
}, |
93
|
|
|
|
|
|
|
'getCurrentUrl' => { |
94
|
|
|
|
|
|
|
'method' => 'GET', |
95
|
|
|
|
|
|
|
'url' => 'session/:sessionId/url', |
96
|
|
|
|
|
|
|
'no_content_success' => 0 |
97
|
|
|
|
|
|
|
}, |
98
|
|
|
|
|
|
|
'get' => { |
99
|
|
|
|
|
|
|
'method' => 'POST', |
100
|
|
|
|
|
|
|
'url' => 'session/:sessionId/url', |
101
|
|
|
|
|
|
|
'no_content_success' => 1 |
102
|
|
|
|
|
|
|
}, |
103
|
|
|
|
|
|
|
'goForward' => { |
104
|
|
|
|
|
|
|
'method' => 'POST', |
105
|
|
|
|
|
|
|
'url' => 'session/:sessionId/forward', |
106
|
|
|
|
|
|
|
'no_content_success' => 1 |
107
|
|
|
|
|
|
|
}, |
108
|
|
|
|
|
|
|
'goBack' => { |
109
|
|
|
|
|
|
|
'method' => 'POST', |
110
|
|
|
|
|
|
|
'url' => 'session/:sessionId/back', |
111
|
|
|
|
|
|
|
'no_content_success' => 1 |
112
|
|
|
|
|
|
|
}, |
113
|
|
|
|
|
|
|
'refresh' => { |
114
|
|
|
|
|
|
|
'method' => 'POST', |
115
|
|
|
|
|
|
|
'url' => 'session/:sessionId/refresh', |
116
|
|
|
|
|
|
|
'no_content_success' => 1 |
117
|
|
|
|
|
|
|
}, |
118
|
|
|
|
|
|
|
'executeScript' => { |
119
|
|
|
|
|
|
|
'method' => 'POST', |
120
|
|
|
|
|
|
|
'url' => 'session/:sessionId/execute', |
121
|
|
|
|
|
|
|
'no_content_success' => 0 |
122
|
|
|
|
|
|
|
}, |
123
|
|
|
|
|
|
|
'executeAsyncScript' => { |
124
|
|
|
|
|
|
|
'method' => 'POST', |
125
|
|
|
|
|
|
|
'url' => 'session/:sessionId/execute_async', |
126
|
|
|
|
|
|
|
'no_content_success' => 0 |
127
|
|
|
|
|
|
|
}, |
128
|
|
|
|
|
|
|
'screenshot' => { |
129
|
|
|
|
|
|
|
'method' => 'GET', |
130
|
|
|
|
|
|
|
'url' => 'session/:sessionId/screenshot', |
131
|
|
|
|
|
|
|
'no_content_success' => 0 |
132
|
|
|
|
|
|
|
}, |
133
|
|
|
|
|
|
|
'availableEngines' => { |
134
|
|
|
|
|
|
|
'method' => 'GET', |
135
|
|
|
|
|
|
|
'url' => 'session/:sessionId/ime/available_engines', |
136
|
|
|
|
|
|
|
'no_content_success' => 0 |
137
|
|
|
|
|
|
|
}, |
138
|
|
|
|
|
|
|
'switchToFrame' => { |
139
|
|
|
|
|
|
|
'method' => 'POST', |
140
|
|
|
|
|
|
|
'url' => 'session/:sessionId/frame', |
141
|
|
|
|
|
|
|
'no_content_success' => 1 |
142
|
|
|
|
|
|
|
}, |
143
|
|
|
|
|
|
|
'switchToWindow' => { |
144
|
|
|
|
|
|
|
'method' => 'POST', |
145
|
|
|
|
|
|
|
'url' => 'session/:sessionId/window', |
146
|
|
|
|
|
|
|
'no_content_success' => 1 |
147
|
|
|
|
|
|
|
}, |
148
|
|
|
|
|
|
|
'getAllCookies' => { |
149
|
|
|
|
|
|
|
'method' => 'GET', |
150
|
|
|
|
|
|
|
'url' => 'session/:sessionId/cookie', |
151
|
|
|
|
|
|
|
'no_content_success' => 0 |
152
|
|
|
|
|
|
|
}, |
153
|
|
|
|
|
|
|
'addCookie' => { |
154
|
|
|
|
|
|
|
'method' => 'POST', |
155
|
|
|
|
|
|
|
'url' => 'session/:sessionId/cookie', |
156
|
|
|
|
|
|
|
'no_content_success' => 1 |
157
|
|
|
|
|
|
|
}, |
158
|
|
|
|
|
|
|
'deleteAllCookies' => { |
159
|
|
|
|
|
|
|
'method' => 'DELETE', |
160
|
|
|
|
|
|
|
'url' => 'session/:sessionId/cookie', |
161
|
|
|
|
|
|
|
'no_content_success' => 1 |
162
|
|
|
|
|
|
|
}, |
163
|
|
|
|
|
|
|
'deleteCookieNamed' => { |
164
|
|
|
|
|
|
|
'method' => 'DELETE', |
165
|
|
|
|
|
|
|
'url' => 'session/:sessionId/cookie/:name', |
166
|
|
|
|
|
|
|
'no_content_success' => 1 |
167
|
|
|
|
|
|
|
}, |
168
|
|
|
|
|
|
|
'getPageSource' => { |
169
|
|
|
|
|
|
|
'method' => 'GET', |
170
|
|
|
|
|
|
|
'url' => 'session/:sessionId/source', |
171
|
|
|
|
|
|
|
'no_content_success' => 0 |
172
|
|
|
|
|
|
|
}, |
173
|
|
|
|
|
|
|
'getTitle' => { |
174
|
|
|
|
|
|
|
'method' => 'GET', |
175
|
|
|
|
|
|
|
'url' => 'session/:sessionId/title', |
176
|
|
|
|
|
|
|
'no_content_success' => 0 |
177
|
|
|
|
|
|
|
}, |
178
|
|
|
|
|
|
|
'findElement' => { |
179
|
|
|
|
|
|
|
'method' => 'POST', |
180
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element', |
181
|
|
|
|
|
|
|
'no_content_success' => 0 |
182
|
|
|
|
|
|
|
}, |
183
|
|
|
|
|
|
|
'findElements' => { |
184
|
|
|
|
|
|
|
'method' => 'POST', |
185
|
|
|
|
|
|
|
'url' => 'session/:sessionId/elements', |
186
|
|
|
|
|
|
|
'no_content_success' => 0 |
187
|
|
|
|
|
|
|
}, |
188
|
|
|
|
|
|
|
'getActiveElement' => { |
189
|
|
|
|
|
|
|
'method' => 'POST', |
190
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/active', |
191
|
|
|
|
|
|
|
'no_content_success' => 0 |
192
|
|
|
|
|
|
|
}, |
193
|
|
|
|
|
|
|
'describeElement' => { |
194
|
|
|
|
|
|
|
'method' => 'GET', |
195
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id', |
196
|
|
|
|
|
|
|
'no_content_success' => 0 |
197
|
|
|
|
|
|
|
}, |
198
|
|
|
|
|
|
|
'findChildElement' => { |
199
|
|
|
|
|
|
|
'method' => 'POST', |
200
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/element', |
201
|
|
|
|
|
|
|
'no_content_success' => 0 |
202
|
|
|
|
|
|
|
}, |
203
|
|
|
|
|
|
|
'findChildElements' => { |
204
|
|
|
|
|
|
|
'method' => 'POST', |
205
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/elements', |
206
|
|
|
|
|
|
|
'no_content_success' => 0 |
207
|
|
|
|
|
|
|
}, |
208
|
|
|
|
|
|
|
'clickElement' => { |
209
|
|
|
|
|
|
|
'method' => 'POST', |
210
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/click', |
211
|
|
|
|
|
|
|
'no_content_success' => 1 |
212
|
|
|
|
|
|
|
}, |
213
|
|
|
|
|
|
|
'submitElement' => { |
214
|
|
|
|
|
|
|
'method' => 'POST', |
215
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/submit', |
216
|
|
|
|
|
|
|
'no_content_success' => 1 |
217
|
|
|
|
|
|
|
}, |
218
|
|
|
|
|
|
|
'sendKeysToElement' => { |
219
|
|
|
|
|
|
|
'method' => 'POST', |
220
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/value', |
221
|
|
|
|
|
|
|
'no_content_success' => 1 |
222
|
|
|
|
|
|
|
}, |
223
|
|
|
|
|
|
|
'sendKeysToActiveElement' => { |
224
|
|
|
|
|
|
|
'method' => 'POST', |
225
|
|
|
|
|
|
|
'url' => 'session/:sessionId/keys', |
226
|
|
|
|
|
|
|
'no_content_success' => 1 |
227
|
|
|
|
|
|
|
}, |
228
|
|
|
|
|
|
|
'sendModifier' => { |
229
|
|
|
|
|
|
|
'method' => 'POST', |
230
|
|
|
|
|
|
|
'url' => 'session/:sessionId/modifier', |
231
|
|
|
|
|
|
|
'no_content_success' => 1 |
232
|
|
|
|
|
|
|
}, |
233
|
|
|
|
|
|
|
'isElementSelected' => { |
234
|
|
|
|
|
|
|
'method' => 'GET', |
235
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/selected', |
236
|
|
|
|
|
|
|
'no_content_success' => 0 |
237
|
|
|
|
|
|
|
}, |
238
|
|
|
|
|
|
|
'setElementSelected' => { |
239
|
|
|
|
|
|
|
'method' => 'POST', |
240
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/selected', |
241
|
|
|
|
|
|
|
'no_content_success' => 0 |
242
|
|
|
|
|
|
|
}, |
243
|
|
|
|
|
|
|
'toggleElement' => { |
244
|
|
|
|
|
|
|
'method' => 'POST', |
245
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/toggle', |
246
|
|
|
|
|
|
|
'no_content_success' => 0 |
247
|
|
|
|
|
|
|
}, |
248
|
|
|
|
|
|
|
'isElementEnabled' => { |
249
|
|
|
|
|
|
|
'method' => 'GET', |
250
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/enabled', |
251
|
|
|
|
|
|
|
'no_content_success' => 0 |
252
|
|
|
|
|
|
|
}, |
253
|
|
|
|
|
|
|
'getElementLocation' => { |
254
|
|
|
|
|
|
|
'method' => 'GET', |
255
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/location', |
256
|
|
|
|
|
|
|
'no_content_success' => 0 |
257
|
|
|
|
|
|
|
}, |
258
|
|
|
|
|
|
|
'getElementLocationInView' => { |
259
|
|
|
|
|
|
|
'method' => 'GET', |
260
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/location_in_view', |
261
|
|
|
|
|
|
|
'no_content_success' => 0 |
262
|
|
|
|
|
|
|
}, |
263
|
|
|
|
|
|
|
'getElementTagName' => { |
264
|
|
|
|
|
|
|
'method' => 'GET', |
265
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/name', |
266
|
|
|
|
|
|
|
'no_content_success' => 0 |
267
|
|
|
|
|
|
|
}, |
268
|
|
|
|
|
|
|
'clearElement' => { |
269
|
|
|
|
|
|
|
'method' => 'POST', |
270
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/clear', |
271
|
|
|
|
|
|
|
'no_content_success' => 1 |
272
|
|
|
|
|
|
|
}, |
273
|
|
|
|
|
|
|
'getElementAttribute' => { |
274
|
|
|
|
|
|
|
'method' => 'GET', |
275
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/attribute/:name', |
276
|
|
|
|
|
|
|
'no_content_success' => 0 |
277
|
|
|
|
|
|
|
}, |
278
|
|
|
|
|
|
|
'elementEquals' => { |
279
|
|
|
|
|
|
|
'method' => 'GET', |
280
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/equals/:other', |
281
|
|
|
|
|
|
|
'no_content_success' => 0 |
282
|
|
|
|
|
|
|
}, |
283
|
|
|
|
|
|
|
'isElementDisplayed' => { |
284
|
|
|
|
|
|
|
'method' => 'GET', |
285
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/displayed', |
286
|
|
|
|
|
|
|
'no_content_success' => 0 |
287
|
|
|
|
|
|
|
}, |
288
|
|
|
|
|
|
|
'close' => { |
289
|
|
|
|
|
|
|
'method' => 'DELETE', |
290
|
|
|
|
|
|
|
'url' => 'session/:sessionId/window', |
291
|
|
|
|
|
|
|
'no_content_success' => 1 |
292
|
|
|
|
|
|
|
}, |
293
|
|
|
|
|
|
|
'getElementSize' => { |
294
|
|
|
|
|
|
|
'method' => 'GET', |
295
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/size', |
296
|
|
|
|
|
|
|
'no_content_success' => 0 |
297
|
|
|
|
|
|
|
}, |
298
|
|
|
|
|
|
|
'getElementText' => { |
299
|
|
|
|
|
|
|
'method' => 'GET', |
300
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/text', |
301
|
|
|
|
|
|
|
'no_content_success' => 0 |
302
|
|
|
|
|
|
|
}, |
303
|
|
|
|
|
|
|
'getElementValueOfCssProperty' => { |
304
|
|
|
|
|
|
|
'method' => 'GET', |
305
|
|
|
|
|
|
|
'url' => 'session/:sessionId/element/:id/css/:propertyName', |
306
|
|
|
|
|
|
|
'no_content_success' => 0 |
307
|
|
|
|
|
|
|
}, |
308
|
|
|
|
|
|
|
'mouseMoveToLocation' => { |
309
|
|
|
|
|
|
|
'method' => 'POST', |
310
|
|
|
|
|
|
|
'url' => 'session/:sessionId/moveto', |
311
|
|
|
|
|
|
|
'no_content_success' => 1 |
312
|
|
|
|
|
|
|
}, |
313
|
|
|
|
|
|
|
'getAlertText' => { |
314
|
|
|
|
|
|
|
'method' => 'GET', |
315
|
|
|
|
|
|
|
'url' => 'session/:sessionId/alert_text', |
316
|
|
|
|
|
|
|
'no_content_success' => 0 |
317
|
|
|
|
|
|
|
}, |
318
|
|
|
|
|
|
|
'sendKeysToPrompt' => { |
319
|
|
|
|
|
|
|
'method' => 'POST', |
320
|
|
|
|
|
|
|
'url' => 'session/:sessionId/alert_text', |
321
|
|
|
|
|
|
|
'no_content_success' => 1 |
322
|
|
|
|
|
|
|
}, |
323
|
|
|
|
|
|
|
'acceptAlert' => { |
324
|
|
|
|
|
|
|
'method' => 'POST', |
325
|
|
|
|
|
|
|
'url' => 'session/:sessionId/accept_alert', |
326
|
|
|
|
|
|
|
'no_content_success' => 1 |
327
|
|
|
|
|
|
|
}, |
328
|
|
|
|
|
|
|
'dismissAlert' => { |
329
|
|
|
|
|
|
|
'method' => 'POST', |
330
|
|
|
|
|
|
|
'url' => 'session/:sessionId/dismiss_alert', |
331
|
|
|
|
|
|
|
'no_content_success' => 1 |
332
|
|
|
|
|
|
|
}, |
333
|
|
|
|
|
|
|
'click' => { |
334
|
|
|
|
|
|
|
'method' => 'POST', |
335
|
|
|
|
|
|
|
'url' => 'session/:sessionId/click', |
336
|
|
|
|
|
|
|
'no_content_success' => 1 |
337
|
|
|
|
|
|
|
}, |
338
|
|
|
|
|
|
|
'doubleClick' => { |
339
|
|
|
|
|
|
|
'method' => 'POST', |
340
|
|
|
|
|
|
|
'url' => 'session/:sessionId/doubleclick', |
341
|
|
|
|
|
|
|
'no_content_success' => 1 |
342
|
|
|
|
|
|
|
}, |
343
|
|
|
|
|
|
|
'buttonDown' => { |
344
|
|
|
|
|
|
|
'method' => 'POST', |
345
|
|
|
|
|
|
|
'url' => 'session/:sessionId/buttondown', |
346
|
|
|
|
|
|
|
'no_content_success' => 1 |
347
|
|
|
|
|
|
|
}, |
348
|
|
|
|
|
|
|
'buttonUp' => { |
349
|
|
|
|
|
|
|
'method' => 'POST', |
350
|
|
|
|
|
|
|
'url' => 'session/:sessionId/buttonup', |
351
|
|
|
|
|
|
|
'no_content_success' => 1 |
352
|
|
|
|
|
|
|
}, |
353
|
|
|
|
|
|
|
'uploadFile' => { |
354
|
|
|
|
|
|
|
'method' => 'POST', |
355
|
|
|
|
|
|
|
'url' => 'session/:sessionId/file', |
356
|
|
|
|
|
|
|
'no_content_success' => 0 |
357
|
|
|
|
|
|
|
}, |
358
|
|
|
|
|
|
|
'getLocalStorageItem' => { |
359
|
|
|
|
|
|
|
'method' => 'GET', |
360
|
|
|
|
|
|
|
'url' => '/session/:sessionId/local_storage/key/:key', |
361
|
|
|
|
|
|
|
'no_content_success' => 0 |
362
|
|
|
|
|
|
|
}, |
363
|
|
|
|
|
|
|
'deleteLocalStorageItem' => { |
364
|
|
|
|
|
|
|
'method' => 'DELETE', |
365
|
|
|
|
|
|
|
'url' => '/session/:sessionId/local_storage/key/:key', |
366
|
|
|
|
|
|
|
'no_content_success' => 1 |
367
|
|
|
|
|
|
|
}, |
368
|
|
|
|
|
|
|
'cacheStatus' => { |
369
|
|
|
|
|
|
|
'method' => 'GET', |
370
|
|
|
|
|
|
|
'url' => 'session/:sessionId/application_cache/status', |
371
|
|
|
|
|
|
|
'no_content_success' => 0 |
372
|
|
|
|
|
|
|
}, |
373
|
|
|
|
|
|
|
'setGeolocation' => { |
374
|
|
|
|
|
|
|
'method' => 'POST', |
375
|
|
|
|
|
|
|
'url' => 'session/:sessionId/location', |
376
|
|
|
|
|
|
|
'no_content_success' => 1 |
377
|
|
|
|
|
|
|
}, |
378
|
|
|
|
|
|
|
'getGeolocation' => { |
379
|
|
|
|
|
|
|
'method' => 'GET', |
380
|
|
|
|
|
|
|
'url' => 'session/:sessionId/location', |
381
|
|
|
|
|
|
|
'no_content_success' => 0 |
382
|
|
|
|
|
|
|
}, |
383
|
|
|
|
|
|
|
'getLog' => { |
384
|
|
|
|
|
|
|
'method' => 'POST', |
385
|
|
|
|
|
|
|
'url' => 'session/:sessionId/log', |
386
|
|
|
|
|
|
|
'no_content_success' => 0 |
387
|
|
|
|
|
|
|
}, |
388
|
|
|
|
|
|
|
'getLogTypes' => { |
389
|
|
|
|
|
|
|
'method' => 'GET', |
390
|
|
|
|
|
|
|
'url' => 'session/:sessionId/log/types', |
391
|
|
|
|
|
|
|
'no_content_success' => 0 |
392
|
|
|
|
|
|
|
}, |
393
|
|
|
|
|
|
|
'setOrientation' => { |
394
|
|
|
|
|
|
|
'method' => 'POST', |
395
|
|
|
|
|
|
|
'url' => 'session/:sessionId/orientation', |
396
|
|
|
|
|
|
|
'no_content_success' => 1 |
397
|
|
|
|
|
|
|
}, |
398
|
|
|
|
|
|
|
'getOrientation' => { |
399
|
|
|
|
|
|
|
'method' => 'GET', |
400
|
|
|
|
|
|
|
'url' => 'session/:sessionId/orientation', |
401
|
|
|
|
|
|
|
'no_content_success' => 0 |
402
|
|
|
|
|
|
|
}, |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
# firefox extension |
405
|
|
|
|
|
|
|
'setContext' => { |
406
|
|
|
|
|
|
|
'method' => 'POST', |
407
|
|
|
|
|
|
|
'url' => 'session/:sessionId/moz/context', |
408
|
|
|
|
|
|
|
'no_content_success' => 1 |
409
|
|
|
|
|
|
|
}, |
410
|
|
|
|
|
|
|
'getContext' => { |
411
|
|
|
|
|
|
|
'method' => 'GET', |
412
|
|
|
|
|
|
|
'url' => 'session/:sessionId/moz/context', |
413
|
|
|
|
|
|
|
'no_content_success' => 0 |
414
|
|
|
|
|
|
|
}, |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
# geckodriver workarounds |
417
|
|
|
|
|
|
|
'executeScriptGecko' => { |
418
|
|
|
|
|
|
|
'method' => 'POST', |
419
|
|
|
|
|
|
|
'url' => 'session/:sessionId/execute/sync', |
420
|
|
|
|
|
|
|
'no_content_success' => 0 |
421
|
|
|
|
|
|
|
}, |
422
|
|
|
|
|
|
|
'executeAsyncScriptGecko' => { |
423
|
|
|
|
|
|
|
'method' => 'POST', |
424
|
|
|
|
|
|
|
'url' => 'session/:sessionId/execute/async', |
425
|
|
|
|
|
|
|
'no_content_success' => 0 |
426
|
|
|
|
|
|
|
}, |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
# /session/:sessionId/local_storage |
429
|
|
|
|
|
|
|
# /session/:sessionId/local_storage/key/:key |
430
|
|
|
|
|
|
|
# /session/:sessionId/local_storage/size |
431
|
|
|
|
|
|
|
# /session/:sessionId/session_storage |
432
|
|
|
|
|
|
|
# /session/:sessionId/session_storage/key/:key |
433
|
|
|
|
|
|
|
# /session/:sessionId/session_storage/size |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
}; |
436
|
|
|
|
|
|
|
} |
437
|
|
|
|
|
|
|
); |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
# helper methods to manipulate the _cmds hash |
440
|
|
|
|
|
|
|
sub get_url { |
441
|
374
|
|
|
374
|
0
|
75298
|
my ( $self, $command ) = @_; |
442
|
374
|
|
|
|
|
6619
|
return $self->get_cmds->{$command}->{url}; |
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
sub get_method { |
446
|
382
|
|
|
382
|
0
|
81256
|
my ( $self, $command ) = @_; |
447
|
382
|
|
|
|
|
6646
|
return $self->get_cmds->{$command}->{method}; |
448
|
|
|
|
|
|
|
} |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
sub get_no_content_success { |
451
|
382
|
|
|
382
|
0
|
76371
|
my ( $self, $command ) = @_; |
452
|
382
|
|
|
|
|
6431
|
return $self->get_cmds->{$command}->{no_content_success}; |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
# This method will replace the template & return |
456
|
|
|
|
|
|
|
sub get_params { |
457
|
198
|
|
|
198
|
0
|
5304
|
my ( $self, $args ) = @_; |
458
|
198
|
50
|
|
|
|
867
|
if ( !( defined $args->{'session_id'} ) ) { |
459
|
0
|
|
|
|
|
0
|
return; |
460
|
|
|
|
|
|
|
} |
461
|
198
|
|
|
|
|
399
|
my $data = {}; |
462
|
198
|
|
|
|
|
363
|
my $command = $args->{'command'}; |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
#Allow fall-back in the event the command passed doesn't exist |
465
|
198
|
50
|
|
|
|
3321
|
return unless $self->get_cmds()->{$command}; |
466
|
|
|
|
|
|
|
|
467
|
198
|
|
|
|
|
1922
|
my $url = $self->get_url($command); |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
# Do the var substitutions. |
470
|
198
|
|
|
|
|
2400
|
$url =~ s/:sessionId/$args->{'session_id'}/; |
471
|
198
|
|
|
|
|
565
|
$url =~ s/:id/$args->{'id'}/; |
472
|
198
|
|
|
|
|
470
|
$url =~ s/:name/$args->{'name'}/; |
473
|
198
|
|
|
|
|
360
|
$url =~ s/:propertyName/$args->{'property_name'}/; |
474
|
198
|
|
|
|
|
337
|
$url =~ s/:other/$args->{'other'}/; |
475
|
198
|
|
|
|
|
365
|
$url =~ s/:windowHandle/$args->{'window_handle'}/; |
476
|
|
|
|
|
|
|
|
477
|
198
|
|
|
|
|
481
|
$data->{'method'} = $self->get_method($command); |
478
|
198
|
|
|
|
|
1803
|
$data->{'no_content_success'} = $self->get_no_content_success($command); |
479
|
198
|
|
|
|
|
1544
|
$data->{'url'} = $url; |
480
|
|
|
|
|
|
|
|
481
|
198
|
|
|
|
|
592
|
return $data; |
482
|
|
|
|
|
|
|
} |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
sub parse_response { |
485
|
288
|
|
|
288
|
0
|
2738
|
my ( $self, $res, $resp ) = @_; |
486
|
288
|
100
|
|
|
|
771
|
if ( ref($resp) eq 'HASH' ) { |
487
|
259
|
100
|
66
|
|
|
1121
|
if ( $resp->{cmd_status} && $resp->{cmd_status} eq 'OK' ) { |
488
|
241
|
|
|
|
|
1308
|
return $resp->{cmd_return}; |
489
|
|
|
|
|
|
|
} |
490
|
18
|
|
|
|
|
55
|
my $msg = "Error while executing command"; |
491
|
18
|
100
|
|
|
|
64
|
$msg .= ": $resp->{cmd_error}" if $resp->{cmd_error}; |
492
|
18
|
100
|
|
|
|
55
|
if ( $resp->{cmd_return} ) { |
493
|
17
|
100
|
|
|
|
59
|
if ( ref( $resp->{cmd_return} ) eq 'HASH' ) { |
494
|
|
|
|
|
|
|
$msg .= ": $res->{command}" |
495
|
16
|
50
|
|
|
|
70
|
if $res->{command}; |
496
|
|
|
|
|
|
|
$msg .= ": $resp->{cmd_return}->{error}->{msg}" |
497
|
16
|
50
|
|
|
|
69
|
if $resp->{cmd_return}->{error}->{msg}; |
498
|
|
|
|
|
|
|
$msg .= ": $resp->{cmd_return}->{message}" |
499
|
16
|
50
|
|
|
|
74
|
if $resp->{cmd_return}->{message}; |
500
|
|
|
|
|
|
|
} |
501
|
|
|
|
|
|
|
else { |
502
|
1
|
|
|
|
|
9
|
$msg .= ": $resp->{cmd_return}"; |
503
|
|
|
|
|
|
|
} |
504
|
|
|
|
|
|
|
} |
505
|
18
|
|
|
|
|
2658
|
croak $msg; |
506
|
|
|
|
|
|
|
} |
507
|
29
|
|
|
|
|
142
|
return $resp; |
508
|
|
|
|
|
|
|
} |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
1; |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
__END__ |