1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

LibWeb+WebDriver: Support running headless WebDriver sessions

This adds an "extension capability" for clients to indicate that a
headless browser should be used for the session.
This commit is contained in:
Timothy Flynn 2022-11-22 07:38:07 -05:00 committed by Linus Groh
parent e840d27d8e
commit 7edd57dc87
6 changed files with 76 additions and 15 deletions

View file

@ -11,6 +11,7 @@
#include <AK/Error.h>
#include <AK/RefPtr.h>
#include <LibCore/Promise.h>
#include <LibWeb/WebDriver/Capabilities.h>
#include <LibWeb/WebDriver/Error.h>
#include <LibWeb/WebDriver/Response.h>
#include <WebDriver/WebContentConnection.h>
@ -20,7 +21,7 @@ namespace WebDriver {
class Session {
public:
Session(unsigned session_id, NonnullRefPtr<Client> client);
Session(unsigned session_id, NonnullRefPtr<Client> client, Web::WebDriver::LadybirdOptions options);
~Session();
unsigned session_id() const { return m_id; }
@ -39,8 +40,11 @@ private:
ErrorOr<NonnullRefPtr<Core::LocalServer>> create_server(String const& socket_path, NonnullRefPtr<ServerPromise> promise);
NonnullRefPtr<Client> m_client;
Web::WebDriver::LadybirdOptions m_options;
bool m_started { false };
unsigned m_id { 0 };
RefPtr<WebContentConnection> m_web_content_connection;
Optional<pid_t> m_browser_pid;
};