Serenity Operating System
1/*
2 * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include <AK/Forward.h>
10#include <AK/JsonValue.h>
11#include <LibJS/Forward.h>
12#include <LibJS/Runtime/Value.h>
13#include <LibWeb/Forward.h>
14
15namespace Web::WebDriver {
16
17enum class ExecuteScriptResultType {
18 PromiseResolved,
19 PromiseRejected,
20 Timeout,
21 JavaScriptError,
22};
23
24struct ExecuteScriptResult {
25 ExecuteScriptResultType type;
26 JS::Value value;
27};
28
29struct ExecuteScriptResultSerialized {
30 ExecuteScriptResultType type;
31 JsonValue value;
32};
33
34ExecuteScriptResultSerialized execute_script(Page& page, DeprecatedString const& body, JS::MarkedVector<JS::Value> arguments, Optional<u64> const& timeout);
35ExecuteScriptResultSerialized execute_async_script(Page& page, DeprecatedString const& body, JS::MarkedVector<JS::Value> arguments, Optional<u64> const& timeout);
36
37}