backport a variety of smaller CDP changes

This commit is contained in:
Karl Seguin
2025-12-19 10:31:07 +08:00
parent a087386af3
commit bb1ea39c54
4 changed files with 99 additions and 14 deletions

View File

@@ -469,6 +469,14 @@ pub fn BrowserContext(comptime CDP_T: type) type {
return if (url.len == 0) null else url;
}
pub fn getTitle(self: *const Self) ?[]const u8 {
const page = self.session.currentPage() orelse return null;
return page.getTitle() catch |err| {
log.err(.cdp, "page title", .{ .err = err });
return null;
};
}
pub fn networkEnable(self: *Self) !void {
try self.cdp.browser.notification.register(.http_request_fail, self, onHttpRequestFail);
try self.cdp.browser.notification.register(.http_request_start, self, onHttpRequestStart);