diff --git a/common/src/web/xhtmlTest.html b/common/src/web/xhtmlTest.html
index d2f3a5da84be5..b69ea2bbb99e0 100644
--- a/common/src/web/xhtmlTest.html
+++ b/common/src/web/xhtmlTest.html
@@ -68,7 +68,7 @@
An H2 title
I'm a parent
-
I'm a child
+
I'm a child
Woo woo
diff --git a/java/client/test/org/openqa/selenium/ElementFindingTest.java b/java/client/test/org/openqa/selenium/ElementFindingTest.java
index 3542355f5c7c6..21539831057c9 100644
--- a/java/client/test/org/openqa/selenium/ElementFindingTest.java
+++ b/java/client/test/org/openqa/selenium/ElementFindingTest.java
@@ -23,6 +23,8 @@
import static org.openqa.selenium.testing.drivers.Browser.CHROME;
import static org.openqa.selenium.testing.drivers.Browser.CHROMIUMEDGE;
import static org.openqa.selenium.testing.drivers.Browser.EDGE;
+import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
+import static org.openqa.selenium.testing.drivers.Browser.HTMLUNIT;
import static org.openqa.selenium.testing.drivers.Browser.IE;
import static org.openqa.selenium.testing.drivers.Browser.MARIONETTE;
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;
@@ -354,20 +356,22 @@ public void testFindingMultipleElementsByCompoundClassNameShouldThrow() {
}
@Test
- public void testFindingASingleElementByInvalidClassNameShouldThrow() {
+ @NotYetImplemented(FIREFOX)
+ @NotYetImplemented(HTMLUNIT)
+ public void testShouldBeAbleToFindASingleElementByAWeirdLookingClassName() {
driver.get(pages.xhtmlTestPage);
- assertThatExceptionOfType(NoSuchElementException.class)
- .isThrownBy(() -> driver.findElement(By.className("!@#$%^&*")));
+ WebElement element = driver.findElement(By.className("cls-!@#$%^&*"));
+ assertThat(element.getAttribute("class")).isEqualTo("cls-!@#$%^&*");
}
@Test
- @NotYetImplemented(MARIONETTE)
- @NotYetImplemented(SAFARI)
- @NotYetImplemented(EDGE)
- public void testFindingMultipleElementsByInvalidClassNameShouldThrow() {
+ @NotYetImplemented(FIREFOX)
+ @NotYetImplemented(HTMLUNIT)
+ public void testShouldBeAbleToFindMultipleElementsByAWeirdLookingClassName() {
driver.get(pages.xhtmlTestPage);
- assertThatExceptionOfType(NoSuchElementException.class)
- .isThrownBy(() -> driver.findElements(By.className("!@#$%^&*")));
+ List elements = driver.findElements(By.className("cls-!@#$%^&*"));
+ assertThat(elements).hasSize(1);
+ assertThat(elements.get(0).getAttribute("class")).isEqualTo("cls-!@#$%^&*");
}
// By.xpath positive