private List<RemoteWebElement> findElements() throws Exception {
JSONObject payload = getRequest().getPayload();
String type = payload.getString("using");
String value = payload.getString("value");
RemoteWebElement element = null;
if (getRequest().hasVariable(":reference")) {
String ref = getRequest().getVariableValue(":reference");
element = getWebDriver().createElement(ref);
} else {
element = getWebDriver().getDocument();
}
List<RemoteWebElement> res;
if ("link text".equals(type)) {
res = element.findElementsByLinkText(value, false);
} else if ("partial link text".equals(type)) {
res = element.findElementsByLinkText(value, true);
} else if ("xpath".equals(type)) {
res = element.findElementsByXpath(value);
} else {
String cssSelector = ToCSSSelectorConverter.convertToCSSSelector(type, value);
res = element.findElementsByCSSSelector(cssSelector);
}
return res;
}