ExecuteScript.h 917 B

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