1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

WebDriver: Implement POST /session/{id}/forward endpoint

This commit is contained in:
Moustafa Raafat 2022-10-15 18:18:35 +01:00 committed by Linus Groh
parent 9132656856
commit a4fa604bde
7 changed files with 46 additions and 0 deletions

View file

@ -206,4 +206,27 @@ ErrorOr<JsonValue, HttpError> Session::back()
return JsonValue();
}
// POST /session/{session id}/forward https://w3c.github.io/webdriver/#dfn-forward
ErrorOr<JsonValue, HttpError> Session::forward()
{
// 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_forward();
// 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();
}
}