IndexDomSelector extends DomSelector { @Override public List<WebElement> findElements(WebDriver driver) { return index == null ? super.findElements(driver) : singletonList(findElement(driver)); } IndexDomSelector(DomSelector selector);  IndexDomSelector(DomSelector selector, Integer index);  IndexDomSelector(SelectorType type, String value, Integer index); @JsonCreator  IndexDomSelector(@JsonProperty("type") SelectorType type, @JsonProperty("value") String value,
			@JsonProperty("frameSelector") DomSelector frameSelector, @JsonProperty("index") Integer index); Integer getIndex(); @Override WebElement findElement(WebDriver driver); @Override WebElement findElement(WebElement element); @Override List<WebElement> findElements(WebDriver driver); @Override List<WebElement> findElements(WebElement element); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void findElements_driver_noIndex() throws Exception { IndexDomSelector selector = new IndexDomSelector(SelectorType.CLASS_NAME, "parent", null); assertThat(selector.findElements(driver), is(asList(parentElement1, parentElement2))); }
@Test public void findElements_driver_index() throws Exception { IndexDomSelector selector = new IndexDomSelector(SelectorType.CLASS_NAME, "parent", 1); assertThat(selector.findElements(driver), is(singletonList(parentElement2))); }
@Test public void findElements_element_noIndex() throws Exception { IndexDomSelector selector = new IndexDomSelector(SelectorType.CLASS_NAME, "parent", null); assertThat(selector.findElements(defaultContentBody), is(asList(parentElement1, parentElement2))); }
@Test public void findElements_element_index() throws Exception { IndexDomSelector selector = new IndexDomSelector(SelectorType.CLASS_NAME, "parent", 1); assertThat(selector.findElements(defaultContentBody), is(singletonList(parentElement2))); }