diff --git a/java/test/org/openqa/selenium/environment/BUILD.bazel b/java/test/org/openqa/selenium/environment/BUILD.bazel
index 753930f4560bb..c6d67de7cdb63 100644
--- a/java/test/org/openqa/selenium/environment/BUILD.bazel
+++ b/java/test/org/openqa/selenium/environment/BUILD.bazel
@@ -116,6 +116,7 @@ java_test_suite(
deps = [
":environment",
":test-base",
+ artifact("org.assertj:assertj-core"),
artifact("org.junit.jupiter:junit-jupiter-api"),
artifact("org.jspecify:jspecify"),
] + firefox["deps"] + JUNIT5_DEPS,
diff --git a/java/test/org/openqa/selenium/environment/webserver/Page.java b/java/test/org/openqa/selenium/environment/webserver/Page.java
index ecbd8e99912a6..dc2f572ff9ec9 100644
--- a/java/test/org/openqa/selenium/environment/webserver/Page.java
+++ b/java/test/org/openqa/selenium/environment/webserver/Page.java
@@ -27,6 +27,7 @@ public class Page {
private String[] bodyParts = {};
private @Nullable String onLoad;
private @Nullable String onBeforeUnload;
+ private boolean doctype = false;
public Page withTitle(String title) {
this.title = title;
@@ -58,7 +59,44 @@ public Page withOnBeforeUnload(String onBeforeUnload) {
return this;
}
+ /**
+ * Opt-in to a standards-mode document shape: a leading {@code } and the {@code
+ * ",
+ "",
+ "",
+ body,
+ String.join("\n", bodyParts),
+ "