mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-04-01 18:06:46 +00:00
Add --wait-selector, --wait-script and --wait-script-file options to fetch
These new optional parameter run AFTER --wait-until, allowing the (imo) useful combination of `--wait-until load --wait-script "report.complete === true"`. However, if `--wait-until` IS NOT specified but `--wait-selector/script` IS, then there is no default wait and it'll just check the selector/script. If neither `--wait-selector` or `--wait-script/--wait-script-file` are specified then `--wait-until` continues to default to `done`. These waiters were added to the Runner, and the existing Action.waitForSelector now uses the runner's version. Selector querying has been split into distinct parse and query functions, so that we can parse once, and query on every tick. We could potentially optimize --wait-script to compile the script once and call it on each tick, but we'd have to detect page navigation to recompile the script in the new context. Something I'd rather optimize separately.
This commit is contained in:
@@ -343,7 +343,7 @@ test "cdp Node: Registry register" {
|
||||
try testing.expectEqual(0, registry.lookup_by_id.count());
|
||||
try testing.expectEqual(0, registry.lookup_by_node.count());
|
||||
|
||||
var page = try testing.pageTest("cdp/registry1.html");
|
||||
var page = try testing.pageTest("cdp/registry1.html", .{});
|
||||
defer page._session.removePage();
|
||||
var doc = page.window._document;
|
||||
|
||||
@@ -400,7 +400,7 @@ test "cdp Node: search list" {
|
||||
}
|
||||
|
||||
{
|
||||
var page = try testing.pageTest("cdp/registry2.html");
|
||||
var page = try testing.pageTest("cdp/registry2.html", .{});
|
||||
defer page._session.removePage();
|
||||
var doc = page.window._document;
|
||||
|
||||
@@ -440,7 +440,7 @@ test "cdp Node: Writer" {
|
||||
var registry = Registry.init(testing.allocator);
|
||||
defer registry.deinit();
|
||||
|
||||
var page = try testing.pageTest("cdp/registry3.html");
|
||||
var page = try testing.pageTest("cdp/registry3.html", .{});
|
||||
defer page._session.removePage();
|
||||
var doc = page.window._document;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user