/
ChangeLog
496 lines (389 loc) · 23.1 KB
/
ChangeLog
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
2017-07-28 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: fix return value of close window command
https://bugs.webkit.org/show_bug.cgi?id=174861
Reviewed by Brian Burg.
We are currently returning null, but we should return the list of window handles, and try to close the session
if there aren't more window handles.
10.2 Close Window
https://w3c.github.io/webdriver/webdriver-spec.html#close-window
3. If there are no more open top-level browsing contexts, then try to close the session.
4. Return the result of running the remote end steps for the Get Window Handles command.
* Session.cpp:
(WebDriver::Session::closeAllToplevelBrowsingContexts): Helper function to close the given toplevel browsing
context and the next one if there are more.
(WebDriver::Session::close): Call closeAllToplevelBrowsingContexts() to delete all toplevel browsing contexts of
the session.
(WebDriver::Session::closeTopLevelBrowsingContext): Close the given toplevel browsing context and call
getWindowHandles() when done.
(WebDriver::Session::closeWindow): Call closeTopLevelBrowsingContext() passing the current toplevel browsing context.
(WebDriver::Session::getWindowHandles): Remove the early return, this command doesn't depend on a current
toplevel browsing context.
* Session.h:
* SessionHost.h:
* WebDriverService.cpp:
(WebDriver::WebDriverService::run): Disconnect the server when main loop quits.
(WebDriver::WebDriverService::deleteSession): Do not fail if the given session is not active.
(WebDriver::WebDriverService::closeWindow): Remove the session if the closed window was the last one.
* WebDriverService.h: Remove unused quit() method.
* glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::isConnected): Return whether host is connected to a browser instance.
(WebDriver::SessionHost::dbusConnectionClosedCallback): Delete m_browser.
2017-08-14 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: handle click events on option elements
https://bugs.webkit.org/show_bug.cgi?id=174710
<rdar://problem/33459305>
Reviewed by Brian Burg.
Option elements are considered as a special case by the specification. When clicking an option element, we
should get its container and use it when scrolling into view and calculating in-view center point instead of the
option element itself. Then, we should not emulate a click, but change the selected status of the option element
like if it were done by a user action, firing the corresponding events. Now we check whether the element is an
option to call selectOptionElement() or performMouseInteraction().
This fixes more than 20 selenium tests.
* CommandResult.cpp:
(WebDriver::CommandResult::CommandResult): Handle ElementNotSelectable protocol error.
(WebDriver::CommandResult::httpStatusCode const): Add ElementNotSelectable.
(WebDriver::CommandResult::errorString const): Ditto.
* CommandResult.h:
* Session.cpp:
(WebDriver::Session::selectOptionElement): Ask automation to select the given option element.
(WebDriver::Session::elementClick): Call selectOptionElement() or performMouseInteraction() depending on whether
the element is an option or not.
* Session.h:
2017-08-11 Carlos Alberto Lopez Perez <clopez@igalia.com>
Fix build warning in WebDriverService.h
https://bugs.webkit.org/show_bug.cgi?id=166682
Unreviewed build fix.
* WebDriverService.h: Fixes the warning: class 'Capabilities' was previously declared as a struct [-Wmismatched-tags]
2017-08-08 Michael Catanzaro <mcatanzaro@igalia.com>
Unreviewed, fix Ubuntu LTS build
https://bugs.webkit.org/show_bug.cgi?id=174490
* glib/SessionHostGlib.cpp:
2017-08-08 Michael Catanzaro <mcatanzaro@igalia.com>
[CMake] Properly test if compiler supports compiler flags
https://bugs.webkit.org/show_bug.cgi?id=174490
Reviewed by Konstantin Tokarev.
* WebDriverService.cpp:
(WebDriver::WebDriverService::run):
* glib/SessionHostGlib.cpp:
2017-08-07 Carlos Garcia Campos <cgarcia@igalia.com>
Web Automation: setUserInputForCurrentJavaScriptPrompt should fail if current dialog is not a prompt
https://bugs.webkit.org/show_bug.cgi?id=175261
Reviewed by Brian Burg.
* CommandResult.cpp:
(WebDriver::CommandResult::CommandResult): Handle ElementNotInteractable protocol error.
2017-08-07 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: implement unhandled prompt behavior
https://bugs.webkit.org/show_bug.cgi?id=175184
Reviewed by Brian Burg.
Handle user prompts before running some of the commands according to the specification.
* Capabilities.h: Add UnhandledPromptBehavior capability.
* CommandResult.cpp:
(WebDriver::CommandResult::httpStatusCode const): Add UnexpectedAlertOpen error.
(WebDriver::CommandResult::errorString const): Ditto.
* CommandResult.h:
(WebDriver::CommandResult::setAdditonalErrorData): New method to set an additional data object that will be sent
as part of the result error message.
(WebDriver::CommandResult::additionalErrorData const): Return the additional data object.
* Session.cpp:
(WebDriver::Session::handleUserPrompts): Check if there's an active JavaScript dialog and deal with it depeding
on the unhandled prompt behavior.
(WebDriver::Session::reportUnexpectedAlertOpen): Generate an error message with UnexpectedAlertOpen error and
including the alert text as additional error data.
(WebDriver::Session::go): Handle user prompts before running the command.
(WebDriver::Session::getCurrentURL): Ditto.
(WebDriver::Session::back): Ditto.
(WebDriver::Session::forward): Ditto.
(WebDriver::Session::refresh): Ditto.
(WebDriver::Session::getTitle): Ditto.
(WebDriver::Session::closeWindow): Ditto.
(WebDriver::Session::switchToFrame): Ditto.
(WebDriver::Session::switchToParentFrame): Ditto.
(WebDriver::Session::isElementSelected): Ditto.
(WebDriver::Session::getElementText): Ditto.
(WebDriver::Session::getElementTagName): Ditto.
(WebDriver::Session::getElementRect): Ditto.
(WebDriver::Session::isElementEnabled): Ditto.
(WebDriver::Session::isElementDisplayed): Ditto.
(WebDriver::Session::getElementAttribute): Ditto.
(WebDriver::Session::elementSendKeys): Ditto.
(WebDriver::Session::elementSubmit): Ditto.
(WebDriver::Session::executeScript): Ditto.
* Session.h:
* WebDriverService.cpp:
(WebDriver::WebDriverService::sendResponse const): Send data object as part of the result error message if present.
(WebDriver::deserializeUnhandledPromptBehavior):
(WebDriver::WebDriverService::parseCapabilities const):
(WebDriver::WebDriverService::validatedCapabilities const):
(WebDriver::WebDriverService::newSession):
2017-08-07 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: implement user prompt commands
https://bugs.webkit.org/show_bug.cgi?id=174614
Reviewed by Brian Burg.
* CommandResult.cpp:
(WebDriver::CommandResult::CommandResult): Handle NoJavaScriptDialog protocol error.
(WebDriver::CommandResult::httpStatusCode const): Add NoSuchAlert.
(WebDriver::CommandResult::errorString const): Ditto.
* CommandResult.h:
* Session.cpp:
(WebDriver::Session::dismissAlert):
(WebDriver::Session::acceptAlert):
(WebDriver::Session::getAlertText):
(WebDriver::Session::sendAlertText):
* Session.h:
* WebDriverService.cpp:
(WebDriver::WebDriverService::dismissAlert):
(WebDriver::WebDriverService::acceptAlert):
(WebDriver::WebDriverService::getAlertText):
(WebDriver::WebDriverService::sendAlertText):
* WebDriverService.h:
2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Add API to provide browser information required by automation
https://bugs.webkit.org/show_bug.cgi?id=175130
Reviewed by Brian Burg.
* Session.cpp:
(WebDriver::Session::createTopLevelBrowsingContext): Check if startAutomationSession and complete the command
with error in that case.
* SessionHost.h:
* glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::matchCapabilities): Match the capabilities that are known only after the browser has
been launched.
(WebDriver::SessionHost::startAutomationSession): Handle the StartAutomationSession response, extracting the
capabilities and calling matchCapabilities() to match them.
(WebDriver::SessionHost::setTargetList): Return early if the session was rejected before due to invalid
capabilities.
2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: Implement page load strategy
https://bugs.webkit.org/show_bug.cgi?id=175183
Reviewed by Brian Burg.
Validate and parse page load strategy when processing capabilities.
* Capabilities.h:
* Session.cpp:
(WebDriver::Session::pageLoadStrategyString const): Helper to get the page load strategy as a String to be
passed to Automation.
(WebDriver::Session::go): Pass page load strategy if present.
(WebDriver::Session::back): Ditto.
(WebDriver::Session::forward): Ditto.
(WebDriver::Session::refresh): Ditto.
(WebDriver::Session::waitForNavigationToComplete): Ditto.
* Session.h:
* WebDriverService.cpp:
(WebDriver::deserializePageLoadStrategy):
(WebDriver::WebDriverService::parseCapabilities const):
(WebDriver::WebDriverService::validatedCapabilities const):
(WebDriver::WebDriverService::newSession):
2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Try to fix build with clang after r220315.
* WebDriverService.cpp:
(WebDriver::WebDriverService::validatedCapabilities const):
(WebDriver::WebDriverService::mergeCapabilities const):
2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: properly handle capabilities and process firstMatch too
https://bugs.webkit.org/show_bug.cgi?id=174618
Reviewed by Brian Burg.
Implement processing of capabilities following the spec. This patch adds validation, merging and matching of
capabilities.
7.2 Processing Capabilities.
https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities
* Capabilities.h: Make all capabilities optional and move Timeouts struct here.
* Session.h:
* WebDriverService.cpp:
(WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object.
(WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated,
so we just need to get them without checking the value type.
(WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of
values are the expected one.
(WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a
single object ensuring that the same capability is not in both.
(WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform
expected capabilities.
(WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities.
(WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from
capabilities and add all capabilities to the command result.
(WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts().
* WebDriverService.h:
* glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional.
(WebDriver::SessionHost::startAutomationSession): Add FIXME.
* gtk/WebDriverServiceGtk.cpp:
(WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled.
(WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions.
(WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now.
(WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions.
(WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been
validated before.
2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: use in-view center point for clicks instead of bounding box center point
https://bugs.webkit.org/show_bug.cgi?id=174863
Reviewed by Simon Fraser.
The center of the element bounding box is not always part of the element, like in multiline links, for example.
11.1 Element Interactability.
https://www.w3.org/TR/webdriver/#dfn-in-view-center-point
* CommandResult.cpp:
(WebDriver::CommandResult::httpStatusCode): Add ElementClickIntercepted and ElementNotInteractable errors.
(WebDriver::CommandResult::errorString): Ditto.
* CommandResult.h: Ditto.
* Session.cpp:
(WebDriver::Session::computeElementLayout): Get the in-view center point and isObscured from the result too.
(WebDriver::Session::getElementRect): Ignore in-view center point and isObscured.
(WebDriver::Session::elementClick): Fail in case the element is not interactable or is obscured.
* Session.h:
2017-08-01 Michael Catanzaro <mcatanzaro@igalia.com>
[CMake] WebKitFS.cmake depends on options set in Option cmake files that are included later
https://bugs.webkit.org/show_bug.cgi?id=174855
Reviewed by Carlos Garcia Campos.
Don't create derived sources directory here anymore.
* PlatformGTK.cmake:
2017-07-26 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Fix GTK distcheck.
Ensure WebDriver derived sources directory is created, WebKitFS.cmake is useless for this.
* PlatformGTK.cmake:
2017-07-24 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: rename m_browsingContext as m_currentBrowsingContext in Session
https://bugs.webkit.org/show_bug.cgi?id=174783
Reviewed by Brian Burg.
We have m_toplevelBrowsingContext and m_browsingContext, which is confusing. m_browsingContext is actually the
current browsing context, and the spec also refers to it as the current browsing context, so better use
m_currentBrowsingContext.
* Session.cpp:
(WebDriver::Session::switchToTopLevelBrowsingContext):
(WebDriver::Session::switchToBrowsingContext):
(WebDriver::Session::switchToFrame):
(WebDriver::Session::switchToParentFrame):
(WebDriver::Session::computeElementLayout):
(WebDriver::Session::findElements):
(WebDriver::Session::isElementSelected):
(WebDriver::Session::getElementText):
(WebDriver::Session::getElementTagName):
(WebDriver::Session::isElementEnabled):
(WebDriver::Session::isElementDisplayed):
(WebDriver::Session::getElementAttribute):
(WebDriver::Session::waitForNavigationToComplete):
(WebDriver::Session::elementClear):
(WebDriver::Session::elementSendKeys):
(WebDriver::Session::elementSubmit):
(WebDriver::Session::executeScript):
* Session.h:
2017-07-20 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: implement page load timeout
https://bugs.webkit.org/show_bug.cgi?id=174672
Reviewed by Brian Burg.
Handle timeout errors and pass the page load timeout to waitForNavigationToComplete and all other navigation
commands. Also fix the setTimeouts command that was still using the legacy name of the page load timeout,
instead of the one in the spec.
8. Sessions
https://www.w3.org/TR/webdriver/#dfn-session-page-load-timeout
* CommandResult.cpp:
(WebDriver::CommandResult::CommandResult):
(WebDriver::CommandResult::httpStatusCode):
(WebDriver::CommandResult::errorString):
* CommandResult.h:
* Session.cpp:
(WebDriver::Session::go):
(WebDriver::Session::back):
(WebDriver::Session::forward):
(WebDriver::Session::refresh):
(WebDriver::Session::waitForNavigationToComplete):
* WebDriverService.cpp:
(WebDriver::WebDriverService::setTimeouts):
2017-07-21 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: wait until navigation is complete before running new commands and after a click
https://bugs.webkit.org/show_bug.cgi?id=174670
Reviewed by Brian Burg.
We are already waiting for navigation to complete after navigation commands (go, back, forward, refresh), but
the spec says we should always wait before executing a new command and also after a click. This is causing test
testShouldBeAbleToNavigateBackInTheBrowserHistoryInPresenceOfIframes to sometimes fail, because it does .click()
+ .title and expects the title to tbe the one of the page loaded by the click. Since the load happens very fast,
the test usually passes, but in a real case with a slower load, the title of the previous page will be returned
most of the times.
6.3 Processing Model. Step 7. Wait for navigation to complete. If this returns an error return its value and
jump to step 1 in this overall algorithm, otherwise continue.
https://www.w3.org/TR/webdriver/#processing-model
14.1 Element Click. Step 10. If the click causes navigation: 1. Run the post-navigation checks and return its
value if it is an error. 2. Try to wait for navigation to complete.
https://www.w3.org/TR/webdriver/#element-click
* Session.cpp:
(WebDriver::Session::waitForNavigationToComplete): Send waitForNavigationToComplete message to the browser to
wait for any pending navigation of current browsing context to complete.
(WebDriver::Session::elementClick): Call waitForNavigationToComplete() after the click.
* Session.h:
* WebDriverService.cpp:
(WebDriver::WebDriverService::go): Wait for navigations to complete before running the command.
(WebDriver::WebDriverService::getCurrentURL): Ditto.
(WebDriver::WebDriverService::back): Ditto.
(WebDriver::WebDriverService::forward): Ditto.
(WebDriver::WebDriverService::refresh): Ditto.
(WebDriver::WebDriverService::getTitle): Ditto.
(WebDriver::WebDriverService::switchToFrame): Ditto.
(WebDriver::WebDriverService::switchToParentFrame): Ditto.
(WebDriver::WebDriverService::findElement): Ditto.
(WebDriver::WebDriverService::findElements): Ditto.
(WebDriver::WebDriverService::executeScript): Ditto.
(WebDriver::WebDriverService::executeAsyncScript): Ditto.
2017-07-21 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: correctly handle main frame handles
https://bugs.webkit.org/show_bug.cgi?id=174668
Reviewed by Brian Burg.
When I switched to use std::optional instead of empty strings for the browsing contexts in WebDriver, I forgot
that automation uses empty string for frames to refer to the main frame. We should handle that case, because we
are currently considering empty strings as valid browsing context. It's not a big deal because Automation
converts back the empty string received to the main frame, though. We should also ensure we close the current
browsing context when switching to a new top level browsing context. This patch adds to helper private methods
to switch browsing contexts that deal with the special cases.
* Session.cpp:
(WebDriver::Session::close):
(WebDriver::Session::switchToTopLevelBrowsingContext):
(WebDriver::Session::switchToBrowsingContext):
(WebDriver::Session::createTopLevelBrowsingContext):
(WebDriver::Session::go):
(WebDriver::Session::back):
(WebDriver::Session::forward):
(WebDriver::Session::refresh):
(WebDriver::Session::switchToWindow):
(WebDriver::Session::switchToFrame):
(WebDriver::Session::switchToParentFrame):
* Session.h:
2017-07-18 Carlos Garcia Campos <cgarcia@igalia.com>
WebDriver: handle invalid selector errors
https://bugs.webkit.org/show_bug.cgi?id=174619
Reviewed by Brian Burg.
Add InvalidSelector error and handle it in case of protocol server error.
* CommandResult.cpp:
(WebDriver::CommandResult::CommandResult):
(WebDriver::CommandResult::httpStatusCode):
(WebDriver::CommandResult::errorString):
* CommandResult.h:
2017-07-18 Carlos Alberto Lopez Perez <clopez@igalia.com>
[GTK] Fix build with Clang after r219605.
https://bugs.webkit.org/show_bug.cgi?id=166682
Unreviewed build fix.
Clang-3.8 complains with the following error:
non-constant-expression cannot be narrowed from type 'gboolean' (aka 'int') to 'bool' in initializer list [-Wc++11-narrowing]
* glib/SessionHostGlib.cpp: insert an explicit cast to silence this issue.
2017-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
Add initial implementation of WebDriver process to run the HTTP server
https://bugs.webkit.org/show_bug.cgi?id=166682
Reviewed by Brian Burg.
Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is
cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with
the remote inspector requires platform specific code. This patch includes the GTK port implementation, using
libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote
inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but
using the official selenium python tests as reference.
* CMakeLists.txt: Added.
* Capabilities.h: Added.
* CommandResult.cpp: Added.
* CommandResult.h: Added.
* HTTPServer.cpp: Added.
* HTTPServer.h: Added.
* PlatformGTK.cmake: Added.
* Session.cpp: Added.
* Session.h: Added.
* SessionHost.cpp: Added.
* SessionHost.h: Added.
* WebDriverMain.cpp: Added.
* WebDriverService.cpp: Added.
* WebDriverService.h: Added.
* config.h: Added.
* glib/SessionHostGlib.cpp: Added.
* gtk/WebDriverServiceGtk.cpp: Added.
* soup/HTTPServerSoup.cpp: Added.