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_name(expectedName, callback) {
try {
callback();
} catch (error) {
assert_equals(error.name, expectedName);
return;
}
throw new Error("expected " + expectedName);
}
[
["xml:fail", "x"],
["A\u00B7A", "x"],
["a0", "data"],
].forEach(function ([target, data]) {
test(function () {
const pi = document.createProcessingInstruction(target, data);
assert_equals(pi.target, target);
assert_equals(pi.data, data);
assert_equals(pi.nodeName, target);
assert_equals(pi.nodeValue, data);
assert_equals(pi.textContent, data);
assert_equals(pi.ownerDocument, document);
assert_equals(pi.nodeType, 7);
assert_true(pi instanceof ProcessingInstruction);
assert_true(pi instanceof CharacterData);
assert_true(pi instanceof Node);
}, "createProcessingInstruction(" + JSON.stringify(target) + ", " + JSON.stringify(data) + ")");
});
[
[
new DOMParser().parseFromString("<html><body></body></html>", "text/html"),
"DOMParser HTML document",
],
[
new DOMParser().parseFromString("<root/>", "application/xml"),
"DOMParser XML document",
],
].forEach(function ([doc, label]) {
test(function () {
const pi = doc.createProcessingInstruction("xml-stylesheet", "href='style.css'");
assert_equals(pi.target, "xml-stylesheet");
assert_equals(pi.data, "href='style.css'");
assert_equals(pi.nodeName, "xml-stylesheet");
assert_equals(pi.nodeValue, "href='style.css'");
assert_equals(pi.textContent, "href='style.css'");
assert_equals(pi.ownerDocument, doc);
assert_equals(pi.nodeType, 7);
assert_true(pi instanceof ProcessingInstruction);
assert_true(pi instanceof CharacterData);
assert_true(pi instanceof Node);
}, label + " exposes createProcessingInstruction()");
});
[
["A", "?>"],
["0", "x"],
["", "x"],
].forEach(function ([target, data]) {
test(function () {
assert_throws_name("InvalidCharacterError", function () {
document.createProcessingInstruction(target, data);
});
}, "createProcessingInstruction rejects target/data " + JSON.stringify([target, data]));
});
test(function () {
const parsed = new DOMParser().parseFromString("<root/>", "application/xml");
assert_throws_name("InvalidCharacterError", function () {
parsed.createProcessingInstruction("A", "?>");
});
}, "DOMParser document createProcessingInstruction rejects invalid data");
</script>