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 assert_throws_dom_name(expectedName, callback, description) {
let error = null;
try {
callback();
} catch (caught) {
error = caught;
}
assert_true(!!error, (description || expectedName) + ": expected an exception");
assert_true(
error instanceof DOMException,
(description || expectedName) + ": expected DOMException",
);
assert_equals(
error.name,
expectedName,
(description || expectedName) + ": exception name",
);
}
test(function () {
assert_throws_dom_name("SyntaxError", function () {
new WebSocket("ws://web platform.test/socket");
}, "space in URL host");
assert_throws_dom_name("SyntaxError", function () {
new WebSocket("wss://example.test/socket#fragment");
}, "URL fragment");
assert_throws_dom_name("SyntaxError", function () {
new WebSocket("wss://example.test/socket", "bad protocol");
}, "protocol token with space");
assert_throws_dom_name("SyntaxError", function () {
new WebSocket("wss://example.test/socket", ["chat", "CHAT"]);
}, "duplicate protocols should compare ASCII-case-insensitively");
}, "WebSocket constructor validates URL and protocol arguments with SyntaxError DOMExceptions");
test(function () {
for (const value of ["a", "a\uDC00x", "a\uD800x", "a\uDC00\uD800x"]) {
const socket = new WebSocket("wss://example.test/socket");
assert_throws_dom_name("InvalidStateError", function () {
socket.send(value);
}, "send while CONNECTING for " + JSON.stringify(value));
}
}, "WebSocket.send() throws InvalidStateError before CONNECTING payload conversion matters");
test(function () {
for (const value of [0, 500, 1004, 1005, 1006, 5000, NaN, "string", null, 0x10000 + 1000]) {
const socket = new WebSocket("wss://example.test/socket");
assert_throws_dom_name("InvalidAccessError", function () {
socket.close(value);
}, "close invalid code " + String(value));
}
assert_throws_dom_name("InvalidAccessError", function () {
new WebSocket("wss://example.test/socket").close("reason only");
}, "close(reason) without an explicit valid code");
}, "WebSocket.close() validates close codes and code-less reasons with InvalidAccessError DOMExceptions");
</script>