1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:38:10 +00:00

WebDriver+Browser: Implement GET /session/{id}/screenshot

This doesn't follow the spec to a tee. Our OutOfProcessWebView already
has a bitmap that can be used as the window screenshot. Therefore, we
can bypass the steps that assume we need to access the window's frame
buffer in-flight.

We also don't create an HTMLCanvasElement. We would need a Document in
the WebDriver process to do so. Instead, we can still run the encoding
steps exactly as-is using the screenshot bitmap.
This commit is contained in:
Timothy Flynn 2022-11-02 12:59:02 -04:00 committed by Linus Groh
parent d603585802
commit 1ffaad29e1
8 changed files with 81 additions and 3 deletions

View file

@ -79,6 +79,7 @@ private:
ErrorOr<JsonValue, WebDriverError> handle_add_cookie(Vector<StringView> const&, JsonValue const& payload);
ErrorOr<JsonValue, WebDriverError> handle_delete_cookie(Vector<StringView> const&, JsonValue const& payload);
ErrorOr<JsonValue, WebDriverError> handle_delete_all_cookies(Vector<StringView> const&, JsonValue const& payload);
ErrorOr<JsonValue, WebDriverError> handle_take_screenshot(Vector<StringView> const&, JsonValue const& payload);
ErrorOr<Session*, WebDriverError> find_session_with_id(StringView session_id);
JsonValue make_json_value(JsonValue const&);