2024-09-13 19:34:47 -04:00
|
|
|
/*
|
2024-09-29 11:44:17 -04:00
|
|
|
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
2024-09-13 19:34:47 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Error.h>
|
|
|
|
#include <AK/JsonObject.h>
|
2025-02-17 13:58:21 -05:00
|
|
|
#include <AK/String.h>
|
2024-11-15 04:01:23 +13:00
|
|
|
#include <LibGC/Ptr.h>
|
2024-11-03 07:11:06 -05:00
|
|
|
#include <LibJS/Forward.h>
|
|
|
|
#include <LibJS/Runtime/Value.h>
|
2025-07-19 19:35:33 -07:00
|
|
|
#include <LibWeb/Export.h>
|
2024-09-13 19:34:47 -04:00
|
|
|
#include <LibWeb/Forward.h>
|
2024-09-29 09:30:45 -04:00
|
|
|
#include <LibWeb/PixelUnits.h>
|
2024-09-13 19:34:47 -04:00
|
|
|
#include <LibWeb/WebDriver/Error.h>
|
|
|
|
|
|
|
|
namespace Web::WebDriver {
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<Web::DOM::Node> get_node(HTML::BrowsingContext const&, StringView reference);
|
2025-02-17 13:58:21 -05:00
|
|
|
String get_or_create_a_node_reference(HTML::BrowsingContext const&, Web::DOM::Node const&);
|
2024-10-24 13:23:38 -04:00
|
|
|
bool node_reference_is_known(HTML::BrowsingContext const&, StringView reference);
|
|
|
|
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API String get_or_create_a_web_element_reference(HTML::BrowsingContext const&, Web::DOM::Node const& element);
|
|
|
|
WEB_API JsonObject web_element_reference_object(HTML::BrowsingContext const&, Web::DOM::Node const& element);
|
|
|
|
WEB_API bool represents_a_web_element(JsonValue const&);
|
|
|
|
WEB_API bool represents_a_web_element(JS::Value);
|
2024-11-15 04:01:23 +13:00
|
|
|
ErrorOr<GC::Ref<Web::DOM::Element>, WebDriver::Error> deserialize_web_element(Web::HTML::BrowsingContext const&, JsonObject const&);
|
|
|
|
ErrorOr<GC::Ref<Web::DOM::Element>, WebDriver::Error> deserialize_web_element(Web::HTML::BrowsingContext const&, JS::Object const&);
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API String extract_web_element_reference(JsonObject const&);
|
|
|
|
WEB_API ErrorOr<GC::Ref<Web::DOM::Element>, Web::WebDriver::Error> get_web_element_origin(Web::HTML::BrowsingContext const&, StringView origin);
|
|
|
|
WEB_API ErrorOr<GC::Ref<Web::DOM::Element>, Web::WebDriver::Error> get_known_element(Web::HTML::BrowsingContext const&, StringView reference);
|
2024-10-10 20:44:01 -04:00
|
|
|
|
2024-09-13 19:41:31 -04:00
|
|
|
bool is_element_stale(Web::DOM::Node const& element);
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API bool is_element_interactable(Web::HTML::BrowsingContext const&, Web::DOM::Element const&);
|
2024-10-11 09:53:52 -04:00
|
|
|
bool is_element_pointer_interactable(Web::HTML::BrowsingContext const&, Web::DOM::Element const&);
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API bool is_element_keyboard_interactable(Web::DOM::Element const&);
|
2024-10-11 09:53:52 -04:00
|
|
|
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API bool is_element_editable(Web::DOM::Element const&);
|
|
|
|
WEB_API bool is_element_mutable(Web::DOM::Element const&);
|
|
|
|
WEB_API bool is_element_mutable_form_control(Web::DOM::Element const&);
|
|
|
|
WEB_API bool is_element_non_typeable_form_control(Web::DOM::Element const&);
|
2024-09-13 19:34:47 -04:00
|
|
|
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API bool is_element_in_view(ReadonlySpan<GC::Ref<Web::DOM::Element>> paint_tree, Web::DOM::Element&);
|
|
|
|
WEB_API bool is_element_obscured(ReadonlySpan<GC::Ref<Web::DOM::Element>> paint_tree, Web::DOM::Element&);
|
|
|
|
WEB_API GC::RootVector<GC::Ref<Web::DOM::Element>> pointer_interactable_tree(Web::HTML::BrowsingContext&, Web::DOM::Element&);
|
2024-10-24 16:17:55 -04:00
|
|
|
|
2025-02-17 13:58:21 -05:00
|
|
|
String get_or_create_a_shadow_root_reference(HTML::BrowsingContext const&, Web::DOM::ShadowRoot const&);
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API JsonObject shadow_root_reference_object(HTML::BrowsingContext const&, Web::DOM::ShadowRoot const&);
|
2024-11-03 07:11:06 -05:00
|
|
|
bool represents_a_shadow_root(JsonValue const&);
|
|
|
|
bool represents_a_shadow_root(JS::Value);
|
2024-11-15 04:01:23 +13:00
|
|
|
ErrorOr<GC::Ref<Web::DOM::ShadowRoot>, WebDriver::Error> deserialize_shadow_root(Web::HTML::BrowsingContext const&, JsonObject const&);
|
|
|
|
ErrorOr<GC::Ref<Web::DOM::ShadowRoot>, WebDriver::Error> deserialize_shadow_root(Web::HTML::BrowsingContext const&, JS::Object const&);
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API ErrorOr<GC::Ref<Web::DOM::ShadowRoot>, Web::WebDriver::Error> get_known_shadow_root(HTML::BrowsingContext const&, StringView reference);
|
2024-10-30 16:57:56 -04:00
|
|
|
bool is_shadow_root_detached(Web::DOM::ShadowRoot const&);
|
2024-09-13 19:34:47 -04:00
|
|
|
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API String element_rendered_text(DOM::Node&);
|
2024-11-03 17:58:32 -05:00
|
|
|
|
2024-09-29 09:30:45 -04:00
|
|
|
CSSPixelPoint in_view_center_point(DOM::Element const& element, CSSPixelRect viewport);
|
|
|
|
|
2024-09-13 19:34:47 -04:00
|
|
|
}
|