2022-11-17 12:57:14 -05:00
|
|
|
/*
|
2025-02-05 11:36:19 -05:00
|
|
|
* Copyright (c) 2022-2025, Tim Flynn <trflynn89@ladybird.org>
|
2022-11-17 12:57:14 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2025-02-07 11:09:28 -05:00
|
|
|
#include <AK/EnumBits.h>
|
2022-11-17 12:57:14 -05:00
|
|
|
#include <AK/Forward.h>
|
|
|
|
#include <AK/StringView.h>
|
2025-07-19 19:35:33 -07:00
|
|
|
#include <LibWeb/Export.h>
|
2022-11-17 12:57:14 -05:00
|
|
|
#include <LibWeb/WebDriver/Response.h>
|
|
|
|
|
|
|
|
namespace Web::WebDriver {
|
|
|
|
|
2025-02-07 11:09:28 -05:00
|
|
|
enum class SessionFlags {
|
|
|
|
Default = 0x0,
|
|
|
|
Http = 0x1,
|
|
|
|
};
|
|
|
|
AK_ENUM_BITWISE_OPERATORS(SessionFlags);
|
|
|
|
|
2022-11-17 12:57:14 -05:00
|
|
|
// https://w3c.github.io/webdriver/#dfn-page-load-strategy
|
|
|
|
enum class PageLoadStrategy {
|
|
|
|
None,
|
|
|
|
Eager,
|
|
|
|
Normal,
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr PageLoadStrategy page_load_strategy_from_string(StringView strategy)
|
|
|
|
{
|
|
|
|
if (strategy == "none"sv)
|
|
|
|
return PageLoadStrategy::None;
|
|
|
|
if (strategy == "eager"sv)
|
|
|
|
return PageLoadStrategy::Eager;
|
|
|
|
if (strategy == "normal"sv)
|
|
|
|
return PageLoadStrategy::Normal;
|
|
|
|
VERIFY_NOT_REACHED();
|
|
|
|
}
|
|
|
|
|
2024-10-21 19:07:55 -04:00
|
|
|
enum class InterfaceMode {
|
|
|
|
Graphical,
|
|
|
|
Headless,
|
|
|
|
};
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API void set_default_interface_mode(InterfaceMode);
|
2024-10-21 19:07:55 -04:00
|
|
|
|
2025-07-19 19:35:33 -07:00
|
|
|
struct WEB_API LadybirdOptions {
|
2022-11-22 07:38:07 -05:00
|
|
|
explicit LadybirdOptions(JsonObject const& capabilities);
|
|
|
|
|
|
|
|
bool headless { false };
|
|
|
|
};
|
|
|
|
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API Response process_capabilities(JsonValue const& parameters, SessionFlags flags);
|
2022-11-17 12:57:14 -05:00
|
|
|
|
|
|
|
}
|