Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
<!doctype html>
<meta charset="utf-8">
<script src="/wpt/resources/testharness.js"></script>
<script src="/wpt/resources/testharnessreport.js"></script>
<script src="/wpt/resources/moli-wpt-adapter.js"></script>
<body
data-top-location-unchanged=""
data-top-history-unchanged=""
data-sync=""
data-timeout=""
>
<iframe
id="child"
src="resources/navigation-child-browsing-context-same-document-result-surface-child.html?mode=replace&step=9"
></iframe>
</body>
<script>
function wait(ms) {
return new Promise(function (resolve) {
setTimeout(resolve, ms);
});
}
function wait_for_value(read, description) {
return Promise.race([
new Promise(function (resolve, reject) {
const deadline = Date.now() + 1000;
function poll() {
const value = read();
if (value) {
resolve(value);
return;
}
if (Date.now() >= deadline) {
reject(new Error("timed out waiting for " + description));
return;
}
setTimeout(poll, 10);
}
poll();
}),
wait(1100).then(function () {
throw new Error("timed out waiting for " + description);
}),
]);
}
promise_test(async function () {
const childUrl = new URL(
"resources/navigation-child-browsing-context-same-document-result-surface-child.html?mode=replace&step=9",
location.href,
).href;
const sync = await wait_for_value(
function () {
return document.body.getAttribute("data-sync");
},
"child replace sync snapshot",
);
const timeout = await wait_for_value(
function () {
return document.body.getAttribute("data-timeout");
},
"child replace timeout snapshot",
);
assert_equals(
document.body.getAttribute("data-top-location-unchanged"),
"true",
"child replace should keep the top-level location unchanged",
);
assert_equals(
document.body.getAttribute("data-top-history-unchanged"),
"true",
"child replace should keep the visible joint history length unchanged",
);
assert_equals(
sync,
"hash=#dest|len=1|committed=false|finished=false|history=null|entry={\"step\":9}|listener=1|property=1|from=" +
childUrl +
"|propertyFrom=" +
childUrl +
"|navType=replace|propertyNavType=replace|order=cec:replace:" +
childUrl +
",popstate:#dest",
"same-document child replace should expose the expected synchronous result surface",
);
assert_equals(
timeout,
"hash=#dest|len=1|committed=true|finished=true|history=null|entry={\"step\":9}|listener=1|property=1|from=" +
childUrl +
"|propertyFrom=" +
childUrl +
"|navType=replace|propertyNavType=replace|order=cec:replace:" +
childUrl +
",popstate:#dest,cec-micro:#dest:null,committed:#dest:true,finished:#dest:true,hashchange:#dest",
"same-document child replace should settle committed/finished and preserve event ordering",
);
}, "Child browsing context same-document replace navigation exposes result promises and event surface locally");
</script>