first version of AXTree

This commit is contained in:
Pierre Tachoire
2025-12-30 12:36:44 +01:00
parent e09d15b12a
commit d6d74c5024
3 changed files with 839 additions and 0 deletions

View File

@@ -289,6 +289,7 @@ pub fn CDPT(comptime TypeProvider: type) type {
pub fn BrowserContext(comptime CDP_T: type) type {
const Node = @import("Node.zig");
const AXNode = @import("AXNode.zig");
return struct {
id: []const u8,
@@ -465,6 +466,16 @@ pub fn BrowserContext(comptime CDP_T: type) type {
};
}
pub fn axnodeWriter(self: *Self, root: *const Node, opts: AXNode.Writer.Opts) !AXNode.Writer {
const page = self.session.currentPage() orelse return error.PageNotLoaded;
_ = opts;
return .{
.page = page,
.root = root,
.registry = &self.node_registry,
};
}
pub fn getURL(self: *const Self) ?[:0]const u8 {
const page = self.session.currentPage() orelse return null;
const url = page.url;