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_html_document_shell(doc, expectedTitle) {
assert_true(doc instanceof Document, "Document identity");
assert_true(doc instanceof Node, "Node identity");
assert_equals(doc.childNodes.length, 2, "document child count");
const doctype = doc.doctype;
assert_true(doctype instanceof DocumentType, "doctype identity");
assert_equals(doctype.name, "html", "doctype name");
assert_equals(doctype.publicId, "", "doctype publicId");
assert_equals(doctype.systemId, "", "doctype systemId");
assert_equals(doctype.ownerDocument, doc, "doctype ownerDocument");
assert_equals(doctype.parentNode, doc, "doctype parentNode");
const html = doc.documentElement;
assert_true(html instanceof HTMLHtmlElement, "html identity");
assert_equals(html.localName, "html", "html localName");
assert_equals(html.tagName, "HTML", "html tagName");
assert_equals(html.childNodes.length, 2, "html child count");
const head = html.firstChild;
assert_true(head instanceof HTMLHeadElement, "head identity");
assert_equals(head, doc.head, "document.head");
assert_equals(head.localName, "head", "head localName");
assert_equals(head.tagName, "HEAD", "head tagName");
const body = html.lastChild;
assert_true(body instanceof HTMLBodyElement, "body identity");
assert_equals(body, doc.body, "document.body");
assert_equals(body.localName, "body", "body localName");
assert_equals(body.tagName, "BODY", "body tagName");
assert_equals(body.childNodes.length, 0, "body child count");
if (expectedTitle === undefined) {
assert_equals(head.childNodes.length, 0, "head should not have title");
assert_equals(doc.title, "", "document title");
} else {
assert_equals(head.childNodes.length, 1, "head should have title");
const title = head.firstChild;
assert_true(title instanceof HTMLTitleElement, "title identity");
assert_equals(title.localName, "title", "title localName");
assert_equals(title.tagName, "TITLE", "title tagName");
assert_equals(title.textContent, expectedTitle, "title textContent");
assert_equals(doc.title, expectedTitle, "document title");
}
}
test(function () {
assert_html_document_shell(document.implementation.createHTMLDocument(), undefined);
assert_html_document_shell(document.implementation.createHTMLDocument(undefined), undefined);
}, "createHTMLDocument() without a title leaves head empty");
test(function () {
assert_html_document_shell(document.implementation.createHTMLDocument("test"), "test");
assert_html_document_shell(document.implementation.createHTMLDocument(null), "null");
}, "createHTMLDocument() creates a title element for string-converted titles");
test(function () {
const doc = document.implementation.createHTMLDocument("metadata");
const div = doc.createElement("DIV");
assert_equals(doc.URL, "about:blank");
assert_equals(doc.documentURI, "about:blank");
assert_equals(doc.baseURI, "about:blank");
assert_equals(doc.compatMode, "CSS1Compat");
assert_equals(doc.characterSet, "UTF-8");
assert_equals(doc.charset, "UTF-8");
assert_equals(doc.inputEncoding, "UTF-8");
assert_equals(doc.contentType, "text/html");
assert_equals(doc.location, null);
assert_equals(div.localName, "div");
assert_true(div instanceof HTMLDivElement);
assert_true(div instanceof HTMLElement);
assert_true(div instanceof Element);
assert_true(div instanceof Node);
assert_equals(Object.prototype.toString.call(div), "[object HTMLDivElement]");
}, "createHTMLDocument() exposes detached HTML document metadata");
</script>