1 2017-10-10 Sam Weinig <sam@webkit.org>
3 Replace copyKeysToVector/copyValuesToVector with copyToVector(map.keys())/copyToVector(map.values())
4 https://bugs.webkit.org/show_bug.cgi?id=178102
6 Reviewed by Tim Horton.
9 (WebDriver::SessionHost::inspectorDisconnected):
11 2017-10-02 Carlos Garcia Campos <cgarcia@igalia.com>
13 WebDriver: HTTP status code is not correct for some of the errors
14 https://bugs.webkit.org/show_bug.cgi?id=177354
16 Reviewed by Brian Burg.
18 I think this changed in the spec at some point. The thing is that no such alert, frame and window and stale
19 element reference errors should return 404 instead of 400.
21 https://w3c.github.io/webdriver/webdriver-spec.html#handling-errors
24 (WebDriver::CommandResult::httpStatusCode const):
26 2017-09-19 Carlos Garcia Campos <cgarcia@igalia.com>
28 WebDriver: Implement commands to get and set the window rect
29 https://bugs.webkit.org/show_bug.cgi?id=177134
31 Reviewed by Brian Burg.
33 We are currently implementing the selenium legacy ones, we should implement the w3c ones instead.
35 https://w3c.github.io/webdriver/webdriver-spec.html#resizing-and-positioning-windows
38 (WebDriver::Session::getToplevelBrowsingContextRect): Helper to get the window rect. This is used by both get
39 and set window rect commands.
40 (WebDriver::Session::moveToplevelBrowsingContextwindow): Helper to ask automation to move the window.
41 (WebDriver::Session::resizeToplevelBrowsingContextwindow): Helper to ask automation to resize the window.
42 (WebDriver::Session::getWindowRect): Handle prompts and then call getToplevelBrowsingContextRect().
43 (WebDriver::Session::setWindowRect): Handle prompts and then move and resize the window according to the given
44 parameters and finish the operation calling getToplevelBrowsingContextRect().
46 * WebDriverService.cpp:
47 (WebDriver::WebDriverService::getWindowRect): Ask the session to get the window rect.
48 (WebDriver::valueAsNumberInRange): Helper to check a value is a valid number in the given range.
49 (WebDriver::WebDriverService::setWindowRect): Get and check size and position from parameters and then ask the
50 session to set the window rect.
53 2017-09-19 Carlos Garcia Campos <cgarcia@igalia.com>
55 WebDriver: wrong response in case of errors
56 https://bugs.webkit.org/show_bug.cgi?id=177127
58 Reviewed by Brian Burg.
60 I misunderstood the spec when I implemented this, so we either return a "value" key with the result in case of
61 success or the error object as the body in case of error. We should always add a "value" key to the body and set
62 it with either the result or the error object.
64 https://w3c.github.io/webdriver/webdriver-spec.html#dfn-send-an-error
66 * WebDriverService.cpp:
67 (WebDriver::WebDriverService::sendResponse const):
69 2017-09-18 Carlos Garcia Campos <cgarcia@igalia.com>
71 WebDriver: wrong key name for capabilities in new session response
72 https://bugs.webkit.org/show_bug.cgi?id=177074
74 Reviewed by Brian Burg.
76 We are using "value", it should be "capabilities".
77 https://w3c.github.io/webdriver/webdriver-spec.html#new-session
79 * WebDriverService.cpp:
80 (WebDriver::WebDriverService::newSession):
82 2017-09-18 Carlos Garcia Campos <cgarcia@igalia.com>
84 WebDriver: HTTP responses should include Cache-Control header with no-cache value
85 https://bugs.webkit.org/show_bug.cgi?id=177073
87 Reviewed by Sergio Villar Senin.
90 Set the response’s header with name and value with the following values:
92 Content-Type "application/json; charset=utf-8"
93 Cache-Control "no-cache"
95 https://w3c.github.io/webdriver/webdriver-spec.html#dfn-send-a-response
97 We were setting the Content-Type, but not the Cache-Control. This is checked by all WPT WebDriver tests.
99 * soup/HTTPServerSoup.cpp:
100 (WebDriver::HTTPServer::listen): Add Cache-Control header.
102 2017-09-18 Michael Catanzaro <mcatanzaro@igalia.com>
104 [CMake] Rename WebKit target to WebKitLegacy and rename WebKit2 target to WebKit
105 https://bugs.webkit.org/show_bug.cgi?id=174558
107 Reviewed by Alex Christensen.
111 2017-09-15 JF Bastien <jfbastien@apple.com>
113 WTF: use Forward.h when appropriate instead of Vector.h
114 https://bugs.webkit.org/show_bug.cgi?id=176984
116 Reviewed by Saam Barati.
118 There's no need to include Vector.h when Forward.h will suffice. All we need is to move the template default parameters from Vector, and then the forward declaration can be used in so many new places: if a header only takes Vector by reference, rvalue reference, pointer, returns any of these, or has them as members then the header doesn't need to see the definition because the declaration will suffice.
122 2017-09-09 Carlos Garcia Campos <cgarcia@igalia.com>
124 WebDriver: ensure we close all windows handles when closing the session
125 https://bugs.webkit.org/show_bug.cgi?id=176508
127 Reviewed by Brian Burg.
129 The spec says that when closing the session all top level browsing contexts should be closed. We are currently
130 checking if we have an active top level browsing context and then we try to close it before trying with the
131 rest. It can happen that we are in an inconsistent state, for example if the current top level browsing context
132 has been closed by JavaScript or another action and the user didn't switch to another one before closing the
133 session. In such case, closing the session will fail with NoSuchwindow and any other window open will not be
134 closed. It's safer to always ask for all window handles and close them, which is what the spec says too.
137 (WebDriver::firstWindowHandleInResult): Helper class to get the first window handle in the result array.
138 (WebDriver::Session::closeAllToplevelBrowsingContexts): Use firstWindowHandleInResult().
139 (WebDriver::Session::close): Close the current top level browsing context and get all window handles to close
142 2017-08-28 Carlos Garcia Campos <cgarcia@igalia.com>
144 WebDriver: implement screen capture commands
145 https://bugs.webkit.org/show_bug.cgi?id=174615
147 Reviewed by Brian Burg.
149 Implement takeScreenshot and takeElementScreenshot commands.
152 https://w3c.github.io/webdriver/webdriver-spec.html#screen-capture
155 (WebDriver::CommandResult::CommandResult): Handle ScreenshotError protocol error.
156 (WebDriver::CommandResult::httpStatusCode const): Add UnableToCaptureScreen.
157 (WebDriver::CommandResult::errorString const): Ditto.
160 (WebDriver::Session::takeScreenshot):
162 * WebDriverService.cpp:
163 (WebDriver::WebDriverService::takeScreenshot):
164 (WebDriver::WebDriverService::takeElementScreenshot):
165 * WebDriverService.h:
167 2017-08-28 Carlos Garcia Campos <cgarcia@igalia.com>
169 WebDriver: implement cookies commands
170 https://bugs.webkit.org/show_bug.cgi?id=174613
172 Reviewed by Brian Burg.
174 Add cookies commands.
177 https://w3c.github.io/webdriver/webdriver-spec.html#cookies
180 (WebDriver::CommandResult::httpStatusCode const): Add NoSuchCookie error.
181 (WebDriver::CommandResult::errorString const): Ditto.
184 (WebDriver::parseAutomationCookie): Parse JSON cookie object returned by automation and convert it to a Cookie struct.
185 (WebDriver::builtAutomationCookie): Build a JSON cookie object as expected by automation from a Cookie struct.
186 (WebDriver::serializeCookie): Serialize a Cookie struct into a JSON cookie object according to the WebDriver spec.
187 (WebDriver::Session::getAllCookies):
188 (WebDriver::Session::getNamedCookie):
189 (WebDriver::Session::addCookie):
190 (WebDriver::Session::deleteCookie):
191 (WebDriver::Session::deleteAllCookies):
193 * WebDriverService.cpp:
194 (WebDriver::WebDriverService::getAllCookies):
195 (WebDriver::WebDriverService::getNamedCookie):
196 (WebDriver::deserializeCookie):
197 (WebDriver::WebDriverService::addCookie):
198 (WebDriver::WebDriverService::deleteCookie):
199 (WebDriver::WebDriverService::deleteAllCookies):
200 * WebDriverService.h:
202 2017-07-28 Carlos Garcia Campos <cgarcia@igalia.com>
204 WebDriver: fix return value of close window command
205 https://bugs.webkit.org/show_bug.cgi?id=174861
207 Reviewed by Brian Burg.
209 We are currently returning null, but we should return the list of window handles, and try to close the session
210 if there aren't more window handles.
213 https://w3c.github.io/webdriver/webdriver-spec.html#close-window
215 3. If there are no more open top-level browsing contexts, then try to close the session.
216 4. Return the result of running the remote end steps for the Get Window Handles command.
219 (WebDriver::Session::closeAllToplevelBrowsingContexts): Helper function to close the given toplevel browsing
220 context and the next one if there are more.
221 (WebDriver::Session::close): Call closeAllToplevelBrowsingContexts() to delete all toplevel browsing contexts of
223 (WebDriver::Session::closeTopLevelBrowsingContext): Close the given toplevel browsing context and call
224 getWindowHandles() when done.
225 (WebDriver::Session::closeWindow): Call closeTopLevelBrowsingContext() passing the current toplevel browsing context.
226 (WebDriver::Session::getWindowHandles): Remove the early return, this command doesn't depend on a current
227 toplevel browsing context.
230 * WebDriverService.cpp:
231 (WebDriver::WebDriverService::run): Disconnect the server when main loop quits.
232 (WebDriver::WebDriverService::deleteSession): Do not fail if the given session is not active.
233 (WebDriver::WebDriverService::closeWindow): Remove the session if the closed window was the last one.
234 * WebDriverService.h: Remove unused quit() method.
235 * glib/SessionHostGlib.cpp:
236 (WebDriver::SessionHost::isConnected): Return whether host is connected to a browser instance.
237 (WebDriver::SessionHost::dbusConnectionClosedCallback): Delete m_browser.
239 2017-08-14 Carlos Garcia Campos <cgarcia@igalia.com>
241 WebDriver: handle click events on option elements
242 https://bugs.webkit.org/show_bug.cgi?id=174710
243 <rdar://problem/33459305>
245 Reviewed by Brian Burg.
247 Option elements are considered as a special case by the specification. When clicking an option element, we
248 should get its container and use it when scrolling into view and calculating in-view center point instead of the
249 option element itself. Then, we should not emulate a click, but change the selected status of the option element
250 like if it were done by a user action, firing the corresponding events. Now we check whether the element is an
251 option to call selectOptionElement() or performMouseInteraction().
253 This fixes more than 20 selenium tests.
256 (WebDriver::CommandResult::CommandResult): Handle ElementNotSelectable protocol error.
257 (WebDriver::CommandResult::httpStatusCode const): Add ElementNotSelectable.
258 (WebDriver::CommandResult::errorString const): Ditto.
261 (WebDriver::Session::selectOptionElement): Ask automation to select the given option element.
262 (WebDriver::Session::elementClick): Call selectOptionElement() or performMouseInteraction() depending on whether
263 the element is an option or not.
266 2017-08-11 Carlos Alberto Lopez Perez <clopez@igalia.com>
268 Fix build warning in WebDriverService.h
269 https://bugs.webkit.org/show_bug.cgi?id=166682
271 Unreviewed build fix.
273 * WebDriverService.h: Fixes the warning: class 'Capabilities' was previously declared as a struct [-Wmismatched-tags]
275 2017-08-08 Michael Catanzaro <mcatanzaro@igalia.com>
277 Unreviewed, fix Ubuntu LTS build
278 https://bugs.webkit.org/show_bug.cgi?id=174490
280 * glib/SessionHostGlib.cpp:
282 2017-08-08 Michael Catanzaro <mcatanzaro@igalia.com>
284 [CMake] Properly test if compiler supports compiler flags
285 https://bugs.webkit.org/show_bug.cgi?id=174490
287 Reviewed by Konstantin Tokarev.
289 * WebDriverService.cpp:
290 (WebDriver::WebDriverService::run):
291 * glib/SessionHostGlib.cpp:
293 2017-08-07 Carlos Garcia Campos <cgarcia@igalia.com>
295 Web Automation: setUserInputForCurrentJavaScriptPrompt should fail if current dialog is not a prompt
296 https://bugs.webkit.org/show_bug.cgi?id=175261
298 Reviewed by Brian Burg.
301 (WebDriver::CommandResult::CommandResult): Handle ElementNotInteractable protocol error.
303 2017-08-07 Carlos Garcia Campos <cgarcia@igalia.com>
305 WebDriver: implement unhandled prompt behavior
306 https://bugs.webkit.org/show_bug.cgi?id=175184
308 Reviewed by Brian Burg.
310 Handle user prompts before running some of the commands according to the specification.
312 * Capabilities.h: Add UnhandledPromptBehavior capability.
314 (WebDriver::CommandResult::httpStatusCode const): Add UnexpectedAlertOpen error.
315 (WebDriver::CommandResult::errorString const): Ditto.
317 (WebDriver::CommandResult::setAdditonalErrorData): New method to set an additional data object that will be sent
318 as part of the result error message.
319 (WebDriver::CommandResult::additionalErrorData const): Return the additional data object.
321 (WebDriver::Session::handleUserPrompts): Check if there's an active JavaScript dialog and deal with it depeding
322 on the unhandled prompt behavior.
323 (WebDriver::Session::reportUnexpectedAlertOpen): Generate an error message with UnexpectedAlertOpen error and
324 including the alert text as additional error data.
325 (WebDriver::Session::go): Handle user prompts before running the command.
326 (WebDriver::Session::getCurrentURL): Ditto.
327 (WebDriver::Session::back): Ditto.
328 (WebDriver::Session::forward): Ditto.
329 (WebDriver::Session::refresh): Ditto.
330 (WebDriver::Session::getTitle): Ditto.
331 (WebDriver::Session::closeWindow): Ditto.
332 (WebDriver::Session::switchToFrame): Ditto.
333 (WebDriver::Session::switchToParentFrame): Ditto.
334 (WebDriver::Session::isElementSelected): Ditto.
335 (WebDriver::Session::getElementText): Ditto.
336 (WebDriver::Session::getElementTagName): Ditto.
337 (WebDriver::Session::getElementRect): Ditto.
338 (WebDriver::Session::isElementEnabled): Ditto.
339 (WebDriver::Session::isElementDisplayed): Ditto.
340 (WebDriver::Session::getElementAttribute): Ditto.
341 (WebDriver::Session::elementSendKeys): Ditto.
342 (WebDriver::Session::elementSubmit): Ditto.
343 (WebDriver::Session::executeScript): Ditto.
345 * WebDriverService.cpp:
346 (WebDriver::WebDriverService::sendResponse const): Send data object as part of the result error message if present.
347 (WebDriver::deserializeUnhandledPromptBehavior):
348 (WebDriver::WebDriverService::parseCapabilities const):
349 (WebDriver::WebDriverService::validatedCapabilities const):
350 (WebDriver::WebDriverService::newSession):
352 2017-08-07 Carlos Garcia Campos <cgarcia@igalia.com>
354 WebDriver: implement user prompt commands
355 https://bugs.webkit.org/show_bug.cgi?id=174614
357 Reviewed by Brian Burg.
360 (WebDriver::CommandResult::CommandResult): Handle NoJavaScriptDialog protocol error.
361 (WebDriver::CommandResult::httpStatusCode const): Add NoSuchAlert.
362 (WebDriver::CommandResult::errorString const): Ditto.
365 (WebDriver::Session::dismissAlert):
366 (WebDriver::Session::acceptAlert):
367 (WebDriver::Session::getAlertText):
368 (WebDriver::Session::sendAlertText):
370 * WebDriverService.cpp:
371 (WebDriver::WebDriverService::dismissAlert):
372 (WebDriver::WebDriverService::acceptAlert):
373 (WebDriver::WebDriverService::getAlertText):
374 (WebDriver::WebDriverService::sendAlertText):
375 * WebDriverService.h:
377 2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
379 [GTK][WPE] Add API to provide browser information required by automation
380 https://bugs.webkit.org/show_bug.cgi?id=175130
382 Reviewed by Brian Burg.
385 (WebDriver::Session::createTopLevelBrowsingContext): Check if startAutomationSession and complete the command
386 with error in that case.
388 * glib/SessionHostGlib.cpp:
389 (WebDriver::SessionHost::matchCapabilities): Match the capabilities that are known only after the browser has
391 (WebDriver::SessionHost::startAutomationSession): Handle the StartAutomationSession response, extracting the
392 capabilities and calling matchCapabilities() to match them.
393 (WebDriver::SessionHost::setTargetList): Return early if the session was rejected before due to invalid
396 2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
398 WebDriver: Implement page load strategy
399 https://bugs.webkit.org/show_bug.cgi?id=175183
401 Reviewed by Brian Burg.
403 Validate and parse page load strategy when processing capabilities.
407 (WebDriver::Session::pageLoadStrategyString const): Helper to get the page load strategy as a String to be
408 passed to Automation.
409 (WebDriver::Session::go): Pass page load strategy if present.
410 (WebDriver::Session::back): Ditto.
411 (WebDriver::Session::forward): Ditto.
412 (WebDriver::Session::refresh): Ditto.
413 (WebDriver::Session::waitForNavigationToComplete): Ditto.
415 * WebDriverService.cpp:
416 (WebDriver::deserializePageLoadStrategy):
417 (WebDriver::WebDriverService::parseCapabilities const):
418 (WebDriver::WebDriverService::validatedCapabilities const):
419 (WebDriver::WebDriverService::newSession):
421 2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
423 Unreviewed. Try to fix build with clang after r220315.
425 * WebDriverService.cpp:
426 (WebDriver::WebDriverService::validatedCapabilities const):
427 (WebDriver::WebDriverService::mergeCapabilities const):
429 2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
431 WebDriver: properly handle capabilities and process firstMatch too
432 https://bugs.webkit.org/show_bug.cgi?id=174618
434 Reviewed by Brian Burg.
436 Implement processing of capabilities following the spec. This patch adds validation, merging and matching of
439 7.2 Processing Capabilities.
440 https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities
442 * Capabilities.h: Make all capabilities optional and move Timeouts struct here.
444 * WebDriverService.cpp:
445 (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object.
446 (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated,
447 so we just need to get them without checking the value type.
448 (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of
449 values are the expected one.
450 (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a
451 single object ensuring that the same capability is not in both.
452 (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform
453 expected capabilities.
454 (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities.
455 (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from
456 capabilities and add all capabilities to the command result.
457 (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts().
458 * WebDriverService.h:
459 * glib/SessionHostGlib.cpp:
460 (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional.
461 (WebDriver::SessionHost::startAutomationSession): Add FIXME.
462 * gtk/WebDriverServiceGtk.cpp:
463 (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled.
464 (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions.
465 (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now.
466 (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions.
467 (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been
470 2017-08-05 Carlos Garcia Campos <cgarcia@igalia.com>
472 WebDriver: use in-view center point for clicks instead of bounding box center point
473 https://bugs.webkit.org/show_bug.cgi?id=174863
475 Reviewed by Simon Fraser.
477 The center of the element bounding box is not always part of the element, like in multiline links, for example.
479 11.1 Element Interactability.
480 https://www.w3.org/TR/webdriver/#dfn-in-view-center-point
483 (WebDriver::CommandResult::httpStatusCode): Add ElementClickIntercepted and ElementNotInteractable errors.
484 (WebDriver::CommandResult::errorString): Ditto.
485 * CommandResult.h: Ditto.
487 (WebDriver::Session::computeElementLayout): Get the in-view center point and isObscured from the result too.
488 (WebDriver::Session::getElementRect): Ignore in-view center point and isObscured.
489 (WebDriver::Session::elementClick): Fail in case the element is not interactable or is obscured.
492 2017-08-01 Michael Catanzaro <mcatanzaro@igalia.com>
494 [CMake] WebKitFS.cmake depends on options set in Option cmake files that are included later
495 https://bugs.webkit.org/show_bug.cgi?id=174855
497 Reviewed by Carlos Garcia Campos.
499 Don't create derived sources directory here anymore.
503 2017-07-26 Carlos Garcia Campos <cgarcia@igalia.com>
505 Unreviewed. Fix GTK distcheck.
507 Ensure WebDriver derived sources directory is created, WebKitFS.cmake is useless for this.
511 2017-07-24 Carlos Garcia Campos <cgarcia@igalia.com>
513 WebDriver: rename m_browsingContext as m_currentBrowsingContext in Session
514 https://bugs.webkit.org/show_bug.cgi?id=174783
516 Reviewed by Brian Burg.
518 We have m_toplevelBrowsingContext and m_browsingContext, which is confusing. m_browsingContext is actually the
519 current browsing context, and the spec also refers to it as the current browsing context, so better use
520 m_currentBrowsingContext.
523 (WebDriver::Session::switchToTopLevelBrowsingContext):
524 (WebDriver::Session::switchToBrowsingContext):
525 (WebDriver::Session::switchToFrame):
526 (WebDriver::Session::switchToParentFrame):
527 (WebDriver::Session::computeElementLayout):
528 (WebDriver::Session::findElements):
529 (WebDriver::Session::isElementSelected):
530 (WebDriver::Session::getElementText):
531 (WebDriver::Session::getElementTagName):
532 (WebDriver::Session::isElementEnabled):
533 (WebDriver::Session::isElementDisplayed):
534 (WebDriver::Session::getElementAttribute):
535 (WebDriver::Session::waitForNavigationToComplete):
536 (WebDriver::Session::elementClear):
537 (WebDriver::Session::elementSendKeys):
538 (WebDriver::Session::elementSubmit):
539 (WebDriver::Session::executeScript):
542 2017-07-20 Carlos Garcia Campos <cgarcia@igalia.com>
544 WebDriver: implement page load timeout
545 https://bugs.webkit.org/show_bug.cgi?id=174672
547 Reviewed by Brian Burg.
549 Handle timeout errors and pass the page load timeout to waitForNavigationToComplete and all other navigation
550 commands. Also fix the setTimeouts command that was still using the legacy name of the page load timeout,
551 instead of the one in the spec.
554 https://www.w3.org/TR/webdriver/#dfn-session-page-load-timeout
557 (WebDriver::CommandResult::CommandResult):
558 (WebDriver::CommandResult::httpStatusCode):
559 (WebDriver::CommandResult::errorString):
562 (WebDriver::Session::go):
563 (WebDriver::Session::back):
564 (WebDriver::Session::forward):
565 (WebDriver::Session::refresh):
566 (WebDriver::Session::waitForNavigationToComplete):
567 * WebDriverService.cpp:
568 (WebDriver::WebDriverService::setTimeouts):
570 2017-07-21 Carlos Garcia Campos <cgarcia@igalia.com>
572 WebDriver: wait until navigation is complete before running new commands and after a click
573 https://bugs.webkit.org/show_bug.cgi?id=174670
575 Reviewed by Brian Burg.
577 We are already waiting for navigation to complete after navigation commands (go, back, forward, refresh), but
578 the spec says we should always wait before executing a new command and also after a click. This is causing test
579 testShouldBeAbleToNavigateBackInTheBrowserHistoryInPresenceOfIframes to sometimes fail, because it does .click()
580 + .title and expects the title to tbe the one of the page loaded by the click. Since the load happens very fast,
581 the test usually passes, but in a real case with a slower load, the title of the previous page will be returned
584 6.3 Processing Model. Step 7. Wait for navigation to complete. If this returns an error return its value and
585 jump to step 1 in this overall algorithm, otherwise continue.
586 https://www.w3.org/TR/webdriver/#processing-model
588 14.1 Element Click. Step 10. If the click causes navigation: 1. Run the post-navigation checks and return its
589 value if it is an error. 2. Try to wait for navigation to complete.
590 https://www.w3.org/TR/webdriver/#element-click
593 (WebDriver::Session::waitForNavigationToComplete): Send waitForNavigationToComplete message to the browser to
594 wait for any pending navigation of current browsing context to complete.
595 (WebDriver::Session::elementClick): Call waitForNavigationToComplete() after the click.
597 * WebDriverService.cpp:
598 (WebDriver::WebDriverService::go): Wait for navigations to complete before running the command.
599 (WebDriver::WebDriverService::getCurrentURL): Ditto.
600 (WebDriver::WebDriverService::back): Ditto.
601 (WebDriver::WebDriverService::forward): Ditto.
602 (WebDriver::WebDriverService::refresh): Ditto.
603 (WebDriver::WebDriverService::getTitle): Ditto.
604 (WebDriver::WebDriverService::switchToFrame): Ditto.
605 (WebDriver::WebDriverService::switchToParentFrame): Ditto.
606 (WebDriver::WebDriverService::findElement): Ditto.
607 (WebDriver::WebDriverService::findElements): Ditto.
608 (WebDriver::WebDriverService::executeScript): Ditto.
609 (WebDriver::WebDriverService::executeAsyncScript): Ditto.
611 2017-07-21 Carlos Garcia Campos <cgarcia@igalia.com>
613 WebDriver: correctly handle main frame handles
614 https://bugs.webkit.org/show_bug.cgi?id=174668
616 Reviewed by Brian Burg.
618 When I switched to use std::optional instead of empty strings for the browsing contexts in WebDriver, I forgot
619 that automation uses empty string for frames to refer to the main frame. We should handle that case, because we
620 are currently considering empty strings as valid browsing context. It's not a big deal because Automation
621 converts back the empty string received to the main frame, though. We should also ensure we close the current
622 browsing context when switching to a new top level browsing context. This patch adds to helper private methods
623 to switch browsing contexts that deal with the special cases.
626 (WebDriver::Session::close):
627 (WebDriver::Session::switchToTopLevelBrowsingContext):
628 (WebDriver::Session::switchToBrowsingContext):
629 (WebDriver::Session::createTopLevelBrowsingContext):
630 (WebDriver::Session::go):
631 (WebDriver::Session::back):
632 (WebDriver::Session::forward):
633 (WebDriver::Session::refresh):
634 (WebDriver::Session::switchToWindow):
635 (WebDriver::Session::switchToFrame):
636 (WebDriver::Session::switchToParentFrame):
639 2017-07-18 Carlos Garcia Campos <cgarcia@igalia.com>
641 WebDriver: handle invalid selector errors
642 https://bugs.webkit.org/show_bug.cgi?id=174619
644 Reviewed by Brian Burg.
646 Add InvalidSelector error and handle it in case of protocol server error.
649 (WebDriver::CommandResult::CommandResult):
650 (WebDriver::CommandResult::httpStatusCode):
651 (WebDriver::CommandResult::errorString):
654 2017-07-18 Carlos Alberto Lopez Perez <clopez@igalia.com>
656 [GTK] Fix build with Clang after r219605.
657 https://bugs.webkit.org/show_bug.cgi?id=166682
659 Unreviewed build fix.
661 Clang-3.8 complains with the following error:
662 non-constant-expression cannot be narrowed from type 'gboolean' (aka 'int') to 'bool' in initializer list [-Wc++11-narrowing]
664 * glib/SessionHostGlib.cpp: insert an explicit cast to silence this issue.
666 2017-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
668 Add initial implementation of WebDriver process to run the HTTP server
669 https://bugs.webkit.org/show_bug.cgi?id=166682
671 Reviewed by Brian Burg.
673 Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is
674 cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with
675 the remote inspector requires platform specific code. This patch includes the GTK port implementation, using
676 libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote
677 inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but
678 using the official selenium python tests as reference.
680 * CMakeLists.txt: Added.
681 * Capabilities.h: Added.
682 * CommandResult.cpp: Added.
683 * CommandResult.h: Added.
684 * HTTPServer.cpp: Added.
685 * HTTPServer.h: Added.
686 * PlatformGTK.cmake: Added.
687 * Session.cpp: Added.
689 * SessionHost.cpp: Added.
690 * SessionHost.h: Added.
691 * WebDriverMain.cpp: Added.
692 * WebDriverService.cpp: Added.
693 * WebDriverService.h: Added.
695 * glib/SessionHostGlib.cpp: Added.
696 * gtk/WebDriverServiceGtk.cpp: Added.
697 * soup/HTTPServerSoup.cpp: Added.