@@ -109,7 +109,7 @@ fn disposeBrowserContext(cmd: anytype) !void {
109109
110110fn createTarget (cmd : anytype ) ! void {
111111 const params = (try cmd .params (struct {
112- // url: []const u8,
112+ url : []const u8 = "about:blank" ,
113113 // width: ?u64 = null,
114114 // height: ?u64 = null,
115115 browserContextId : ? []const u8 = null ,
@@ -167,7 +167,7 @@ fn createTarget(cmd: anytype) !void {
167167 .targetInfo = TargetInfo {
168168 .attached = false ,
169169 .targetId = target_id ,
170- .title = "about:blank" ,
170+ .title = params . url ,
171171 .browserContextId = bc .id ,
172172 .url = "about:blank" ,
173173 },
@@ -178,6 +178,11 @@ fn createTarget(cmd: anytype) !void {
178178 try doAttachtoTarget (cmd , target_id );
179179 }
180180
181+ try page .navigate (params .url , .{
182+ .reason = .address_bar ,
183+ .cdp_id = cmd .input .id ,
184+ });
185+
181186 try cmd .sendResult (.{
182187 .targetId = target_id ,
183188 }, .{});
@@ -517,7 +522,7 @@ test "cdp.target: createTarget" {
517522 {
518523 var ctx = testing .context ();
519524 defer ctx .deinit ();
520- try ctx .processMessage (.{ .id = 10 , .method = "Target.createTarget" , .params = .{ .url = "about/ blank" } });
525+ try ctx .processMessage (.{ .id = 10 , .method = "Target.createTarget" , .params = .{ .url = "about: blank" } });
521526
522527 // should create a browser context
523528 const bc = ctx .cdp ().browser_context .? ;
@@ -529,7 +534,7 @@ test "cdp.target: createTarget" {
529534 defer ctx .deinit ();
530535 // active auto attach to get the Target.attachedToTarget event.
531536 try ctx .processMessage (.{ .id = 9 , .method = "Target.setAutoAttach" , .params = .{ .autoAttach = true , .waitForDebuggerOnStart = false } });
532- try ctx .processMessage (.{ .id = 10 , .method = "Target.createTarget" , .params = .{ .url = "about/ blank" } });
537+ try ctx .processMessage (.{ .id = 10 , .method = "Target.createTarget" , .params = .{ .url = "about: blank" } });
533538
534539 // should create a browser context
535540 const bc = ctx .cdp ().browser_context .? ;
0 commit comments