mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:37:45 +00:00
LibWeb: Implement the element location strategies in Web::WebDriver
This commit is contained in:
parent
40b07901ac
commit
15916e5c14
3 changed files with 114 additions and 0 deletions
|
@ -0,0 +1,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);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue