Skip to content

Commit 100b2a6

Browse files
authored
Merge pull request #1254 from lightpanda-io/cdp-request-node
cdp: implement DOM.requestNode
2 parents a8437af + ea75740 commit 100b2a6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/cdp/domains/dom.zig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub fn processMessage(cmd: anytype) !void {
4343
requestChildNodes,
4444
getFrameOwner,
4545
getOuterHTML,
46+
requestNode,
4647
}, cmd.input.action) orelse return error.UnknownMethod;
4748

4849
switch (action) {
@@ -61,6 +62,7 @@ pub fn processMessage(cmd: anytype) !void {
6162
.requestChildNodes => return requestChildNodes(cmd),
6263
.getFrameOwner => return getFrameOwner(cmd),
6364
.getOuterHTML => return getOuterHTML(cmd),
65+
.requestNode => return requestNode(cmd),
6466
}
6567
}
6668

@@ -518,6 +520,17 @@ fn getOuterHTML(cmd: anytype) !void {
518520
return cmd.sendResult(.{ .outerHTML = aw.written() }, .{});
519521
}
520522

523+
fn requestNode(cmd: anytype) !void {
524+
const params = (try cmd.params(struct {
525+
objectId: []const u8,
526+
})) orelse return error.InvalidParams;
527+
528+
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
529+
const node = try getNode(cmd.arena, bc, null, null, params.objectId);
530+
531+
return cmd.sendResult(.{ .nodeId = node.id }, .{});
532+
}
533+
521534
const testing = @import("../testing.zig");
522535

523536
test "cdp.dom: getSearchResults unknown search id" {

0 commit comments

Comments
 (0)