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>
<script>
function next_worker_result(worker) {
return new Promise(function (resolve, reject) {
function cleanup() {
worker.removeEventListener("message", onMessage);
worker.removeEventListener("error", onError);
}
function onMessage(event) {
cleanup();
resolve(event);
}
function onError(event) {
cleanup();
reject(event.error || new Error(event.message || "worker error"));
}
worker.addEventListener("message", onMessage);
worker.addEventListener("error", onError);
});
}
promise_test(async function () {
const workerUrl = new URL(
"/wpt/ported/worker/resources/worker-xhr-worker.js",
location.href,
).href;
const expectedUrl = new URL(
"/wpt/ported/worker/resources/worker-xhr-target.js",
location.href,
).href;
const worker = new Worker(workerUrl);
try {
worker.postMessage({ mode: "basic" });
const message = await next_worker_result(worker);
assert_equals(message.data.mode, "basic", "worker should report the basic mode");
assert_equals(message.data.ctor, "function", "XMLHttpRequest constructor should exist");
assert_true(
message.data.eventTarget,
"worker xhr should inherit from XMLHttpRequestEventTarget",
);
assert_equals(
message.data.uploadTag,
"[object XMLHttpRequestUpload]",
"worker xhr should expose the upload object brand",
);
assert_equals(message.data.status, 200, "worker xhr status");
assert_equals(
message.data.url,
expectedUrl,
"worker xhr should resolve relative URLs against the worker script URL",
);
assert_equals(message.data.text, "hello from worker xhr", "worker xhr response text");
assert_equals(message.data.readyState, 4, "worker xhr terminal readyState");
assert_array_equals(
message.data.events,
[
"prop-rs:readystatechange:1",
"rs:readystatechange:1",
"prop-rs:readystatechange:2",
"rs:readystatechange:2",
"prop-rs:readystatechange:3",
"rs:readystatechange:3",
"prop-rs:readystatechange:4",
"rs:readystatechange:4",
"prop-load:200",
"load:200:hello from worker xhr",
"prop-loadend:4",
"loadend:4",
],
"worker xhr should report browser-style event ordering across property and listener handlers",
);
} finally {
worker.terminate();
}
}, "Dedicated workers resolve XMLHttpRequest URLs relative to the worker script and dispatch success events");
</script>