use of org.asqatasun.rules.domelement.DomElement in project Asqatasun by Asqatasun.
the class Rgaa22Rule07111 method doSelect.
@Override
protected void doSelect(Collection<DomElement> domElements, SSPHandler sspHandler) {
for (DomElement domElement : domElements) {
if (domElement.isFocusable()) {
Element el = DomElementExtractor.getElementFromDomElement(domElement, sspHandler);
treatFocusableElement(el, domElement, getElements());
}
}
}
use of org.asqatasun.rules.domelement.DomElement in project Asqatasun by Asqatasun.
the class DomElementExtractor method getDomElementFromJson.
/**
*
* @param element
* @return an instance of DomElement
* @throws JSONException
*/
private static DomElement getDomElementFromJson(JSONObject element) throws JSONException {
Iterator<String> keys = element.keys();
DomElement domElement = new DomElement();
while (keys.hasNext()) {
String key = keys.next();
try {
domElement.addProperty(key, element.get(key).toString());
} catch (Exception e) {
}
}
return domElement;
}
use of org.asqatasun.rules.domelement.DomElement in project Asqatasun by Asqatasun.
the class DomElementExtractor method extractDomElements.
/**
*
* @param sspHandler
* @return a collection of instanciated DomElement
* @throws NoResultException
*/
public static Collection<DomElement> extractDomElements(SSPHandler sspHandler) throws NoResultException {
String ppr = sspHandler.getPreProcessResult(COLOR_EXTRACTOR_PRE_PROCESS_RESULT_KEY, sspHandler.getPage());
Collection<DomElement> domElements = new ArrayList<>();
JSONArray json;
try {
json = new JSONArray(ppr);
for (int i = 0; i < json.length(); i++) {
domElements.add(getDomElementFromJson(new JSONObject(json.get(i).toString())));
}
} catch (JSONException ex) {
LOGGER.warn(ex);
}
return domElements;
}
use of org.asqatasun.rules.domelement.DomElement in project Asqatasun by Asqatasun.
the class Rgaa32016Rule100701 method doSelect.
@Override
protected void doSelect(Collection<DomElement> domElements, SSPHandler sspHandler) {
for (DomElement domElement : domElements) {
if (domElement.isFocusable()) {
Element el = DomElementExtractor.getElementFromDomElement(domElement, sspHandler);
treatFocusableElement(el, domElement, getElements());
}
}
}
Aggregations