use of org.asqatasun.rules.elementselector.ElementSelector in project Asqatasun by Asqatasun.
the class SeoRule06031 method select.
@Override
protected void select(SSPHandler sspHandler) {
ElementSelector es = new SimpleElementSelector(TITLE_WITHIN_HEAD_CSS_LIKE_QUERY);
es.selectElements(sspHandler, elementHandler);
}
use of org.asqatasun.rules.elementselector.ElementSelector in project Asqatasun by Asqatasun.
the class Aw22Rule11011 method select.
@Override
protected void select(SSPHandler sspHandler) {
// Selection of all the input form elements of the page
ElementSelector elementSelector = new SimpleElementSelector(FORM_ELEMENT_CSS_LIKE_QUERY);
elementSelector.selectElements(sspHandler, inputFormHandler);
// the selection of the input form elements without label is initialised
// with all the elements of the page, some elements will be removed later
inputFormWithoutLabelHandler.addAll(inputFormHandler.get());
// selection of the input form elements with explicit label
ElementHandler<Element> inputFormLabelHandler = new ElementHandlerImpl();
ElementSelector explicitLabelSelector = new InputFormElementWithExplicitLabelSelector(inputFormHandler);
explicitLabelSelector.selectElements(sspHandler, inputFormLabelHandler);
// remove all the input form elements with explicit label from
// the selection of the input form elements without label
inputFormWithoutLabelHandler.removeAll(inputFormLabelHandler.get());
// selection of the input form with inplicit label
ElementSelector inplicitLabelSelector = new InputFormElementWithInplicitLabelSelector(inputFormHandler);
inplicitLabelSelector.selectElements(sspHandler, inputFormLabelHandler);
// remove all the input form elements with inplicit label from
// the selection of the input form elements without label
inputFormWithoutLabelHandler.removeAll(inputFormLabelHandler.get());
}
use of org.asqatasun.rules.elementselector.ElementSelector in project Asqatasun by Asqatasun.
the class Aw22Rule11013 method select.
@Override
protected void select(SSPHandler sspHandler) {
ElementSelector elementSelector = new SimpleElementSelector(FORM_LABEL_WITH_INNER_FORM_ELEMENT_CSS_LIKE_QUERY);
elementSelector.selectElements(sspHandler, innerControlLabelElements);
ElementSelector explicitLabelSelector = new InputFormElementWithExplicitLabelSelector();
explicitLabelSelector.selectElements(sspHandler, explicitLabelElements);
}
use of org.asqatasun.rules.elementselector.ElementSelector in project Asqatasun by Asqatasun.
the class Rgaa22Rule06021 method select.
@Override
protected void select(SSPHandler sspHandler) {
ElementHandler<Element> tmpElHandler = new ElementHandlerImpl();
/* the image link element selector */
LinkElementSelector linkElementSelector = new LinkElementSelector(false);
linkElementSelector.selectElements(sspHandler, tmpElHandler);
for (Element el : linkElementSelector.getDecidableElements().get()) {
if (doesElementHaveRequestedTargetAttribute(el)) {
imageLinks.add(el);
}
}
LinkElementSelector compositeLinkElementSelector = new CompositeLinkElementSelector(false, false);
tmpElHandler.clean();
compositeLinkElementSelector.selectElements(sspHandler, tmpElHandler);
for (Element el : compositeLinkElementSelector.getDecidableElements().get()) {
if (doesElementHaveRequestedTargetAttribute(el)) {
imageLinks.add(el);
}
}
linkSelected = imageLinks.get().size();
ElementSelector formElementSelector = new SimpleElementSelector(HtmlElementStore.FORM_ELEMENT);
tmpElHandler.clean();
formElementSelector.selectElements(sspHandler, tmpElHandler);
for (Element el : tmpElHandler.get()) {
if (doesElementHaveRequestedTargetAttribute(el)) {
formWithTargetHandler.add(el);
}
}
}
use of org.asqatasun.rules.elementselector.ElementSelector in project Asqatasun by Asqatasun.
the class Rgaa30Rule060501 method select.
@Override
protected void select(SSPHandler sspHandler) {
ElementSelector elementsSelector = new SimpleElementSelector(NOT_ANCHOR_LINK_CSS_LIKE_QUERY);
elementsSelector.selectElements(sspHandler, linksHandler);
for (Element el : linksHandler.get()) {
if (StringUtils.isBlank(el.text()) && el.getElementsByAttributeValueMatching(ALT_ATTR, "^(?=\\s*\\S).*$").isEmpty()) {
emptyLinksHandler.add(el);
}
}
}
Aggregations