@Test
public void insideTopLevelTest() {

    Path el = div.before(span).insideTopLevel();
    NodeList nodes = findAllByXpath("<div>foo</div><span></span>><div>boo</div>", el);
    assertThat(el.getXPath().get(), equalTo("//span/preceding::div"));
    assertThat(nodes.getLength(), is(1));
    assertThat(getText(nodes.item(0)), equalTo("foo"));
    assertThat(el.toString(), is(equalTo("div, before span")));
}