1 2017-07-24 Carlos Garcia Campos <cgarcia@igalia.com>
3 WebDriver: rename m_browsingContext as m_currentBrowsingContext in Session
4 https://bugs.webkit.org/show_bug.cgi?id=174783
6 Reviewed by Brian Burg.
8 We have m_toplevelBrowsingContext and m_browsingContext, which is confusing. m_browsingContext is actually the
9 current browsing context, and the spec also refers to it as the current browsing context, so better use
10 m_currentBrowsingContext.
13 (WebDriver::Session::switchToTopLevelBrowsingContext):
14 (WebDriver::Session::switchToBrowsingContext):
15 (WebDriver::Session::switchToFrame):
16 (WebDriver::Session::switchToParentFrame):
17 (WebDriver::Session::computeElementLayout):
18 (WebDriver::Session::findElements):
19 (WebDriver::Session::isElementSelected):
20 (WebDriver::Session::getElementText):
21 (WebDriver::Session::getElementTagName):
22 (WebDriver::Session::isElementEnabled):
23 (WebDriver::Session::isElementDisplayed):
24 (WebDriver::Session::getElementAttribute):
25 (WebDriver::Session::waitForNavigationToComplete):
26 (WebDriver::Session::elementClear):
27 (WebDriver::Session::elementSendKeys):
28 (WebDriver::Session::elementSubmit):
29 (WebDriver::Session::executeScript):
32 2017-07-20 Carlos Garcia Campos <cgarcia@igalia.com>
34 WebDriver: implement page load timeout
35 https://bugs.webkit.org/show_bug.cgi?id=174672
37 Reviewed by Brian Burg.
39 Handle timeout errors and pass the page load timeout to waitForNavigationToComplete and all other navigation
40 commands. Also fix the setTimeouts command that was still using the legacy name of the page load timeout,
41 instead of the one in the spec.
44 https://www.w3.org/TR/webdriver/#dfn-session-page-load-timeout
47 (WebDriver::CommandResult::CommandResult):
48 (WebDriver::CommandResult::httpStatusCode):
49 (WebDriver::CommandResult::errorString):
52 (WebDriver::Session::go):
53 (WebDriver::Session::back):
54 (WebDriver::Session::forward):
55 (WebDriver::Session::refresh):
56 (WebDriver::Session::waitForNavigationToComplete):
57 * WebDriverService.cpp:
58 (WebDriver::WebDriverService::setTimeouts):
60 2017-07-21 Carlos Garcia Campos <cgarcia@igalia.com>
62 WebDriver: wait until navigation is complete before running new commands and after a click
63 https://bugs.webkit.org/show_bug.cgi?id=174670
65 Reviewed by Brian Burg.
67 We are already waiting for navigation to complete after navigation commands (go, back, forward, refresh), but
68 the spec says we should always wait before executing a new command and also after a click. This is causing test
69 testShouldBeAbleToNavigateBackInTheBrowserHistoryInPresenceOfIframes to sometimes fail, because it does .click()
70 + .title and expects the title to tbe the one of the page loaded by the click. Since the load happens very fast,
71 the test usually passes, but in a real case with a slower load, the title of the previous page will be returned
74 6.3 Processing Model. Step 7. Wait for navigation to complete. If this returns an error return its value and
75 jump to step 1 in this overall algorithm, otherwise continue.
76 https://www.w3.org/TR/webdriver/#processing-model
78 14.1 Element Click. Step 10. If the click causes navigation: 1. Run the post-navigation checks and return its
79 value if it is an error. 2. Try to wait for navigation to complete.
80 https://www.w3.org/TR/webdriver/#element-click
83 (WebDriver::Session::waitForNavigationToComplete): Send waitForNavigationToComplete message to the browser to
84 wait for any pending navigation of current browsing context to complete.
85 (WebDriver::Session::elementClick): Call waitForNavigationToComplete() after the click.
87 * WebDriverService.cpp:
88 (WebDriver::WebDriverService::go): Wait for navigations to complete before running the command.
89 (WebDriver::WebDriverService::getCurrentURL): Ditto.
90 (WebDriver::WebDriverService::back): Ditto.
91 (WebDriver::WebDriverService::forward): Ditto.
92 (WebDriver::WebDriverService::refresh): Ditto.
93 (WebDriver::WebDriverService::getTitle): Ditto.
94 (WebDriver::WebDriverService::switchToFrame): Ditto.
95 (WebDriver::WebDriverService::switchToParentFrame): Ditto.
96 (WebDriver::WebDriverService::findElement): Ditto.
97 (WebDriver::WebDriverService::findElements): Ditto.
98 (WebDriver::WebDriverService::executeScript): Ditto.
99 (WebDriver::WebDriverService::executeAsyncScript): Ditto.
101 2017-07-21 Carlos Garcia Campos <cgarcia@igalia.com>
103 WebDriver: correctly handle main frame handles
104 https://bugs.webkit.org/show_bug.cgi?id=174668
106 Reviewed by Brian Burg.
108 When I switched to use std::optional instead of empty strings for the browsing contexts in WebDriver, I forgot
109 that automation uses empty string for frames to refer to the main frame. We should handle that case, because we
110 are currently considering empty strings as valid browsing context. It's not a big deal because Automation
111 converts back the empty string received to the main frame, though. We should also ensure we close the current
112 browsing context when switching to a new top level browsing context. This patch adds to helper private methods
113 to switch browsing contexts that deal with the special cases.
116 (WebDriver::Session::close):
117 (WebDriver::Session::switchToTopLevelBrowsingContext):
118 (WebDriver::Session::switchToBrowsingContext):
119 (WebDriver::Session::createTopLevelBrowsingContext):
120 (WebDriver::Session::go):
121 (WebDriver::Session::back):
122 (WebDriver::Session::forward):
123 (WebDriver::Session::refresh):
124 (WebDriver::Session::switchToWindow):
125 (WebDriver::Session::switchToFrame):
126 (WebDriver::Session::switchToParentFrame):
129 2017-07-18 Carlos Garcia Campos <cgarcia@igalia.com>
131 WebDriver: handle invalid selector errors
132 https://bugs.webkit.org/show_bug.cgi?id=174619
134 Reviewed by Brian Burg.
136 Add InvalidSelector error and handle it in case of protocol server error.
139 (WebDriver::CommandResult::CommandResult):
140 (WebDriver::CommandResult::httpStatusCode):
141 (WebDriver::CommandResult::errorString):
144 2017-07-18 Carlos Alberto Lopez Perez <clopez@igalia.com>
146 [GTK] Fix build with Clang after r219605.
147 https://bugs.webkit.org/show_bug.cgi?id=166682
149 Unreviewed build fix.
151 Clang-3.8 complains with the following error:
152 non-constant-expression cannot be narrowed from type 'gboolean' (aka 'int') to 'bool' in initializer list [-Wc++11-narrowing]
154 * glib/SessionHostGlib.cpp: insert an explicit cast to silence this issue.
156 2017-07-13 Carlos Garcia Campos <cgarcia@igalia.com>
158 Add initial implementation of WebDriver process to run the HTTP server
159 https://bugs.webkit.org/show_bug.cgi?id=166682
161 Reviewed by Brian Burg.
163 Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is
164 cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with
165 the remote inspector requires platform specific code. This patch includes the GTK port implementation, using
166 libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote
167 inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but
168 using the official selenium python tests as reference.
170 * CMakeLists.txt: Added.
171 * Capabilities.h: Added.
172 * CommandResult.cpp: Added.
173 * CommandResult.h: Added.
174 * HTTPServer.cpp: Added.
175 * HTTPServer.h: Added.
176 * PlatformGTK.cmake: Added.
177 * Session.cpp: Added.
179 * SessionHost.cpp: Added.
180 * SessionHost.h: Added.
181 * WebDriverMain.cpp: Added.
182 * WebDriverService.cpp: Added.
183 * WebDriverService.h: Added.
185 * glib/SessionHostGlib.cpp: Added.
186 * gtk/WebDriverServiceGtk.cpp: Added.
187 * soup/HTTPServerSoup.cpp: Added.