summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebDriver/ElementLocationStrategies.h
blob: 8d82286a21e332c43af9523405fde149f6e62d28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
 * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Array.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/DOM/NodeList.h>
#include <LibWeb/Forward.h>
#include <LibWeb/WebDriver/Error.h>

namespace Web::WebDriver {

// https://w3c.github.io/webdriver/#dfn-table-of-location-strategies
enum class LocationStrategy {
    CssSelector,
    LinkText,
    PartialLinkText,
    TagName,
    XPath,
};

Optional<LocationStrategy> location_strategy_from_string(StringView type);
ErrorOr<JS::NonnullGCPtr<DOM::NodeList>, Error> invoke_location_strategy(LocationStrategy type, DOM::ParentNode& start_node, StringView selector);

}