From b51cca561752eda32937bf693dbee9bd9b613541 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Thu, 15 Jan 2026 13:06:22 +0100 Subject: [PATCH] axnode: use select.getValue --- src/cdp/AXNode.zig | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/cdp/AXNode.zig b/src/cdp/AXNode.zig index 0745aa2a..7347d106 100644 --- a/src/cdp/AXNode.zig +++ b/src/cdp/AXNode.zig @@ -424,27 +424,10 @@ pub const Writer = struct { break :blk val; }, .select => blk: { - // Get the selected option's text content - var it = node.childrenIterator(); - while (it.next()) |child| { - if (child.is(DOMNode.Element.Html) == null) { - continue; - } - const child_el = child.as(DOMNode.Element); - if (child_el.getTag() != .option) { - continue; - } - const option = child_el.as(DOMNode.Element.Html.Option); - if (option.getSelected()) { - // Get the text content of the option - var buf = std.Io.Writer.Allocating.init(self.page.call_arena); - try child_el.getInnerText(&buf.writer); - const text = buf.written(); - if (text.len == 0) break :blk null; - break :blk text; - } - } - break :blk null; + const select = el.as(DOMNode.Element.Html.Select); + const val = select.getValue(self.page); + if (val.len == 0) break :blk null; + break :blk val; }, else => null, };