if (size > 0)
switchToFrame(driver, selectedFrameLocators.subList(0, size - 1));
else
log.warn("The current selected frame is top level. \"" + ploc + "\" is ignored.");
} else {
throw new SeleniumException("Invalid \"relative\" locator argument: " + ploc.arg);
}
return Arrays.asList(driver.switchTo().activeElement());
} else if (ploc.isTypeIndex()) {
switchToFrame(driver, selectedFrameLocators);
List<WebElement> frames = driver.findElements(By.tagName("iframe"));
if (frames.isEmpty())
frames = driver.findElements(By.tagName("frame"));
int index = ploc.getIndex();
if (index < 0 || index >= frames.size())
throw new SeleniumException("\"index\" locator argument is out of range: " + ploc.arg);
return Arrays.asList(frames.get(index));
} else {
switchToFrame(driver, selectedFrameLocators);
return findElementsInternal(driver, ploc, selectedFrameLocators);
}