mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:47:35 +00:00
WebDriver: Implement POST /session/{id}/back endpoint
This commit is contained in:
parent
443ffab9dc
commit
9132656856
7 changed files with 46 additions and 0 deletions
|
@ -183,4 +183,27 @@ ErrorOr<JsonValue, HttpError> Session::refresh()
|
|||
return JsonValue();
|
||||
}
|
||||
|
||||
// POST /session/{session id}/back https://w3c.github.io/webdriver/#dfn-back
|
||||
ErrorOr<JsonValue, HttpError> Session::back()
|
||||
{
|
||||
// 1. If the current top-level browsing context is no longer open, return error with error code no such window.
|
||||
auto current_window = get_window_object();
|
||||
if (!current_window.has_value())
|
||||
return HttpError { 404, "no such window", "Window not found" };
|
||||
|
||||
// FIXME: 2. Handle any user prompts and return its value if it is an error.
|
||||
|
||||
// 3. Traverse the history by a delta –1 for the current browsing context.
|
||||
m_browser_connection->async_back();
|
||||
|
||||
// FIXME: 4. If the previous step completed results in a pageHide event firing, wait until pageShow event
|
||||
// fires or for the session page load timeout milliseconds to pass, whichever occurs sooner.
|
||||
|
||||
// FIXME: 5. If the previous step completed by the session page load timeout being reached, and user
|
||||
// prompts have been handled, return error with error code timeout.
|
||||
|
||||
// 6. Return success with data null.
|
||||
return JsonValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue