@Test
public void isOnlyChildTest() {

    Path el = span.that(hasTextContaining("x").and(isOnlyChild));
    String xpath = el.getXPath().get();
    NodeList nodes = findAllByXpath("<div><span> class=\"a\">x</span><span class=\"b\">x</span></div><div><span class=\"c\">x</span></div><div class=\"d\">x</div>", el);
    assertThat(nodes.getLength(), is(1));
    assertThat(getCssClass(nodes.item(0)), is("c"));
    assertThat(el.toString(), is(equalTo("span, (has text containing \"x\" and is only child)")));
}