ElementLocationStrategies.h 754 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
  3. * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibJS/Heap/GCPtr.h>
  9. #include <LibWeb/DOM/NodeList.h>
  10. #include <LibWeb/Forward.h>
  11. #include <LibWeb/WebDriver/Error.h>
  12. namespace Web::WebDriver {
  13. // https://w3c.github.io/webdriver/#dfn-table-of-location-strategies
  14. enum class LocationStrategy {
  15. CssSelector,
  16. LinkText,
  17. PartialLinkText,
  18. TagName,
  19. XPath,
  20. };
  21. Optional<LocationStrategy> location_strategy_from_string(StringView type);
  22. ErrorOr<JS::NonnullGCPtr<DOM::NodeList>, Error> invoke_location_strategy(LocationStrategy type, DOM::ParentNode& start_node, StringView selector);
  23. }