mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 12:44:43 +00:00
feat: fetch add wait_until parameter for page loads options
Add `--wait_until` and `--wait_ms` CLI arguments to configure session wait behavior. Updates `Session.wait` to evaluate specific page load states (`load`, `domcontentloaded`, `networkidle`, `fixed`) before completing the wait loop.
This commit is contained in:
@@ -131,7 +131,7 @@ pub fn CDPT(comptime TypeProvider: type) type {
|
||||
// timeouts (or http events) which are ready to be processed.
|
||||
pub fn pageWait(self: *Self, ms: u32) Session.WaitResult {
|
||||
const session = &(self.browser.session orelse return .no_page);
|
||||
return session.wait(ms);
|
||||
return session.wait(ms, .load);
|
||||
}
|
||||
|
||||
// Called from above, in processMessage which handles client messages
|
||||
|
||||
@@ -280,7 +280,7 @@ test "cdp.lp: action tools" {
|
||||
const page = try bc.session.createPage();
|
||||
const url = "http://localhost:9582/src/browser/tests/mcp_actions.html";
|
||||
try page.navigate(url, .{ .reason = .address_bar, .kind = .{ .push = null } });
|
||||
_ = bc.session.wait(5000);
|
||||
_ = bc.session.wait(5000, .load);
|
||||
|
||||
// Test Click
|
||||
const btn = page.document.getElementById("btn", page).?.asNode();
|
||||
|
||||
@@ -136,7 +136,7 @@ const TestContext = struct {
|
||||
0,
|
||||
);
|
||||
try page.navigate(full_url, .{});
|
||||
_ = bc.session.wait(2000);
|
||||
_ = bc.session.wait(2000, .load);
|
||||
}
|
||||
return bc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user